Bizagi exposes an OData API to enable external services invocations which return business and project data and make it possible to trigger actions that otherwise should be done via the Work Portal.
Through such API you may execute create records (values) of a parameter entity, by providing the expected parameters to the corresponding URL. In this article a simple example will guide you through this specific feature.
Once you have pinpointed the entity you wish to add records to and the parameters it is expecting through the following service calls:
Then you may perform a call to https://[your_server]/[your_project]/odata/data/entities([ID_entity])/creationParameters to obtain the parameters that must be sent to perform a value creation of the specified entity. The following image illustrates an invocation to such method.
You may also drill down on such values by invoking the following services:
•https://[your_server]/[your_project]/odata/data/entities([ID_entity])/creationParameters([ID_param]) to receive additional information of the specific parameter.
•https://[your_server]/[your_project]/odata/data/entities([ID_entity])/creationParameters([ID_param])/values to receive the possible values that can be sent to create a register, in case the parameter is of type Entity.
Lets create a register on the City entity by providing the parameters shown before. To do so, you can rely on the https://[your_server]/[your_project]/odata/data/entities([ID_entity])/create method.
Bear in mind that:
•Such method is only applicable for Parameter and Stakeholder entities.
•Make sure that the parameters being sent are the ones included in the AddForm or the default form in case there is no AddForm. This parameters are the ones obtained by the .../creationParameters method.
•You can disable / enable values just as you can do it in Studio or in the Work Portal.
•For Stakeholders the associatedUser field is mandatory.
•When the register is finally created, the return value of the invocation is the GUID of the new register.
Since we want to create a City, we have to send in our request's parameters the values for Name, Code and Disabled. The following image shows how to do such a thing in the body of the request.
On the bottom of the image, appreciate that the GUID for the city that was just created (Paris with city code 4) is provided as the response of the service invocation.
Lets query for that ID to check if it was effectively added as a register of the City entity.
Since the service invocation was successful and the retrieved values are the ones of the register that was previously created, it is safe to say that the new City was successfully added.