Example: Use Request and Collection Data as Query Parameters in a ProcessMaker API Call
Learn how to reference Request data and Collection record data as parameters when calling a ProcessMaker API endpoint.
Intended audience: Process designers, Web designers, graphic designers, software developers, coding engineers
Tags: Collections; PMQL; Request Variable
In the example below, reference Request data and data from a specified Colletion record in the URL query to a ProcessMaker API endpoint. Determine dynamically the specific Collection record by including a PMQL query within a ProcessMaker API call. The PMQL query uses a Request variable's value using mustache syntax for the Request variable's value in the URL to the API call.
Consider the following use case. Reference Collection data from Collection
5
for records created based on Requests started on a specific date. Determine the date dynamically by referencing a date in Request data stored in a Request variable date
. The date that each Request starts is stored in another Request variable date_work_start
.- 1.
- 2.Open a new Web browser tab or window.
- 3.Connect to the ProcessMaker API for your ProcessMaker instance, such as
https://MyOrganization.processmaker.net/api/1.0
. See Access ProcessMaker RESTful API Documentation for more information. - 4.Append to your URL the Collections syntax as desired such as
https://MyOrganization.processmaker.net/api/1.0/collections/5/records
.In the URL above,collections/5/records
calls for the records in Collection5
. - 5.Perform PMQL syntax as desired such as
https://MyOrganization.processmaker.net/api/1.0/collections/5/records?pmql=data.date_work_start
. Wheredata
is calling the information of the collection records which specifically call information in the variabledate_work_start
. - 6.Add a Request variable to your PMQL such as
https://MyOrganization.processmaker.net/api/1.0/collections/5/records?pmql=data.date_work_start="{{date}}"
, where the{{date}}
is a comparison value that requires quotations marks. - 7.
Last modified 1yr ago