Learn how to reference Request data and Collection record data as parameters when calling a ProcessMaker Platform API endpoint.
Overview
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 r in the URL query to a ProcessMaker API endpoint. Determine dynamically the specific Collection record by including a PMQL query within a ProcessMaker Platform 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.
Log on to ProcessMaker Platform.
Open a new Web browser tab or window.
Connect to the API for your ProcessMaker Platform instance, such as
https://MyOrganization.processmaker.net/api/1.0. For more information, see Access ProcessMaker Platform RESTful API Documentation.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/recordscalls for the records in Collection5.Perform PMQL syntax as desired such as
https://MyOrganization.processmaker.net/api/1.0/collections/5/records?pmql=data.date_work_start. Wheredatais calling the information of the collection records which specifically call information in the variabledate_work_start.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.Optionally, test your URL using a Data Connector Endpoint.