Execute Queries

<< Click to Display Table of Contents >>

Navigation:  Bizagi Studio > Bizagi from external applications > Bizagi API > OData services > Services index > Data services > Queries data >

Execute Queries

Overview

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 queries, 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 query you want to perform and the parameters it is expecting through the following service calls:

 

https://[your_server]/[your_project]/odata/data/queries

https://[your_server]/[your_project]/odata/data/queries([ID_query])

https://[your_server]/[your_project]/odata/data/queries([ID_query])/parameters

 

Then you may perform a call to https://[your_server]/[your_project]/odata/data/queries([ID_query])/executeQuery sending in the body the query parameters you want to use to perform the query. The request should be executed as shown in the image below.

 

OData_Queries04

 

The query above, receives as input a CandidateName which belongs to the HireCandidate process entity, so the Xpath is specified in the syntax shown. On the "value" parameter, you are free to send any value you would like to query for. Bizagi will perform the query as it was being done via the Work Portal, and it will respond with the results of the query as it is shown in the following image.

 

OData_Queries05

 

As it can be seen, the response includes the total number of records found under the "@odata.totalCount" field. After that general information, under the "values" object, you can find the detail of the query's result. In this case it shows the case #101, which satisfies the condition given: It's CandidateName is Jorge, as shown in the image below.

 

OData_Queries06

 

Important considerations

There might be situations where you might need to use the same control twice in a single Query Form. For example, you might want to find those cases created between two CreationDates. In those cases, to enhance your own understanding and help Bizagi identify to which of those parameters you are referring to, you have to use the searchType attribute for those Query parameters. You can obtain the searchType needed by performing an invocation of the https://[your_server]/[your_project]/odata/data/queries([ID_query])/parameters service.