Example: Use Request and Collection Data as Query Parameters in a ProcessMaker Platform API Call

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 Collection record 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.

  1. Log on to ProcessMaker Platform.

  2. Open a new Web browser tab or window.

  3. Connect to the API for your ProcessMaker Platform instance, such ashttps://MyOrganization.processmaker.net/api/1.0. For more information, see Access ProcessMaker Platform RESTful API Documentation.

  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. 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. 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. Optionally, test your URL using a Data Connector Endpoint.

pageWhat is a Data Connector?pageWhat is a Collection?pageWhat is PMQL?pageWhat is a Request Variable?

Last updated

© Copyright 2000-2024 ProcessMaker Inc. All rights reserved.