ProcessMaker 4.2
ProcessMaker API Documentation
ProcessMaker Examples
Deprecation Notices
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.

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 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. 1.
    Log on to ProcessMaker.
  2. 2.
    Open a new Web browser tab or window.
  3. 3.
    Connect to the ProcessMaker API for your ProcessMaker instance, such ashttps://MyOrganization.processmaker.net/api/1.0. See Access ProcessMaker RESTful API Documentation for more information.
  4. 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 Collection 5.
  5. 5.
    Perform PMQL syntax as desired such as https://MyOrganization.processmaker.net/api/1.0/collections/5/records?pmql=data.date_work_start. Where data is calling the information of the collection records which specifically call information in the variable date_work_start.
  6. 6.
    Add a Request variable to your PMQL such ashttps://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. 7.
    Optionally, test your URL using a Data Connector Endpoint.

Related Topics

Export as PDF
Copy link
Edit on GitHub