Key Capabilities
Send REST API requests using GET, POST, PUT, or DELETE methods.
Include parameters, headers, and body content in your requests.
Use variables to pass values dynamically at runtime.
Parse API responses to extract specific data for further use in workflows.
To create a REST API configuration in Qntrl:
Navigate to (settings) >> WEB SERVICES >> Outbound >> Click REST.
Click Create API in the top-right corner.
Enter a name for the API in the left sidebar.
Select the HTTP method: GET, POST, PUT, or DELETE.
Enter the API URL (endpoint) of the service to which the request should be sent.
KEY: Name of the query parameter.
VALUE: Input based on the formats mentioned above.
Headers : Set required HTTP headers for the request.
KEY: Header name (e.g., Authorization)
VALUE: Input based on the formats mentioned above.
Body (POST & PUT Only) : Select the format and provide the data.
None: Select this if the request does not require a body.
form-data: Enter the keys and values.
x-www-form-urlencoded: Enter the keys and values.
Raw: Supports Text, JSON, or XML for complex payloads.
You can insert variables anywhere in the request configuration using the {{variableName}} syntax.
Static Values: Entered manually in the UI (via "Test API With Variable Values").
Dynamic Values: Passed at runtime using scripts or Codex.
When triggering from Codex, provide variables as a JSON object:
These values will replace the placeholders {{jobId}} and {{email}} across Query Params, Headers, and Body.
After execution, use the Response Parser to extract specific data from the JSON response.
Qntrl automatically filters the response and suggests commonly used JSON paths.
From the suggestions, click ADD next to a path, give it a name, and click SAVE to store it.
You can add multiple fields to extract the data you need.
The extracted values will appear as the Applied Response during the next execution, displayed alongside the full original response.
function beforeSend() {try {var queryParams = webservice.outboundREST.getQueryParameter();console.log("Query parameters "+queryParams);// Add a new query parameter.var timestamp = new Date().toISOString();webservice.outboundREST.addQueryParameter("timestamp", timestamp);// Replace variable values.var variables = {};variables["user_id"] = "21499000000115251";webservice.outboundREST.replaceVariableValues(variables);// Add a custom headerwebservice.outboundREST.addHeader("x-tracking-id", "track-" + Date.now() );console.log("Modified query params --> " + webservice.outboundREST.getQueryParameter());console.log("Modified headers --> " + webservice.outboundREST.getHeader());} catch (e) {console.log("Error in beforeSend: " + e.message);webservice.outboundREST.setResponseCode(500);}}
function afterSend(){var appliedResponse = JSON.parse(webservice.outboundREST.getAppliedResponse());console.log("appliedResponse -->" + appliedResponse);var variables = JSON.parse(webservice.outboundREST.getVariableValues());var varJson = {};varJson['account_id'] = appliedResponse.CRM_Account_ID;varJson['oauth_token'] = variables.oauth_token;var crmResponse = OutboundREST.executeByName("GetAccountDetailsCRM", varJson);if (!crmResponse || Object.keys(crmResponse).length === 0){webservice.outboundREST.setResponseCode(500);webservice.outboundREST.addResponseHeader("crm_error","unable to fetch CRM data.");}else{appliedResponse['crmResponse'] = crmResponse;webservice.outboundREST.setAppliedResponse(JSON.stringify(appliedResponse));console.log("appliedResponse -->" + JSON.stringify(appliedResponse));}}
The afterSend() function is triggered automatically after an outbound REST API request is made.
It retrieves additional details from an external CRM system using data received in the initial API response.
The final response contains both the original data and enriched CRM data.
To save the configuration:
Click Save. The API will now be listed in the left sidebar.
Click Send to execute and test the API. This also saves the API configuration.
After execution, view results under the Response tab.
Use the unique ID of the configured REST API to trigger execution via script.
Syntax
OutboundREST.execute("<api_id>", <variables>);
let requestData = {};requestData["approvalStatus"] = "Approved";OutboundREST.execute(31453000002078039, requestData);
Call the REST API using the configured API name and a key-value pair object of variables.
Syntax
OutboundREST.executeByName("api_name", <variables>);
let requestData = {};requestData["approvalStatus"] = "Approved";OutboundREST.executeByName("TaskApprovalAPI", requestData);
You can manage your Outbound REST API using the available options in the left panel.
Enable or Disable: Use the toggle switch next to the API name to activate or deactivate the API.
Rename or Delete: Click the more actions (...) icon next to the API and choose Rename or Delete as needed.
You are currently viewing the help articles of Qntrl 3.0. If you are still using our older version and require guidance with it, Click here.