invokeUrl Function
Table of Contents
Note:
Each time the invokeUrl() task is executed, it triggers an API request to the back-end. This call is deducted from the external calls limit available for the service from which the task is executed, based on your pricing plan.
When using Zoho Creator APIs with in the invokeUrl() task, the limits deducted depend on where the request originates and where it is received.
Outbound request from Creator to an external service - Only the External calls limit is deducted from the Creator account that sends the request.
Inbound request to Creator from an external service - The Developer API limit is deducted from the target Creator account, and the external calls limit is deducted from the service that sends the request.
Internal request within the same Creator account - Both the Developer API limit and the External calls limit are deducted from that Creator account.
Request between two different Creator accounts - The Developer API limit is deducted from the target Creator account, and the External calls limit is deducted from the Creator account that sends the request.
Only actual executions that receive a response (whether success or failure) are counted, not the number of times the task appears in the script. For example, if the task is placed inside a for each task that iterates five times, five external API calls will be consumed, even though the task appears only once in the script.Each invokeUrl task execution triggers an API call in the back-end. These API calls are deducted from your overall external calls limit that is provided for your Creator plan. Here, the system counts the number of actual executions, and not the number of times the task appears in the script.
Overview
The invoke URL function is used to make API calls.
Note:
- This function is applicable only to Zoho Creator
- Users are advised to use the invoke URL task since this function will be deprecated.
- Each invokeUrl function execution triggers an API call in the back-end. These API calls are deducted from your overall external calls limit that is provided for your Creator plan. Here, the system counts the number of actual executions, and not the number of times the task appears in the script.
Return Type
- Text
- Key-value
Syntax
To use the various HTTP methods:
(OR)
To use the various HTTP methods along with header information:
| Parameter | Data type | Description |
|---|---|---|
<variable> (optional) | TEXT KEY-VALUE | Variable which will contain the returned response. |
| <stringUrl> | TEXT | is the URL specified in external services API to perform different actions. For example, to post a tweet, use the URL specified in Twitter API. |
| <type> | TEXT | Applicable values: GET, POST, PUT, PATCH, and DELETE. |
| <body> | KEY-VALUE TEXT | is used to send body along with the request. KEY-VALUE data will be sent as "x-www-form-urlencoded" type. TEXT data will be sent as "raw" type. This is an optional param when using the GET method. |
<headerMap> (optional) | KEY-VALUE | Variable holding header values as key-value pairs. |
<boolean> (optional) | BOOLEAN | Value 'true' will return a simple response content as text. Value 'false' will return the response code (HTTP status code), and response content as key-value. Default value is true. |
Examples
The following snippet will fetch records from Leads module in Zoho CRM
urlData = "https://crm.zoho.com/crm/internal/json/Leads/getRecords"; authtoken = "xxxxxxxxx"; // refers to your authtoken testparams = Map(); testparams.put("authtoken", authtoken); response = invokeUrl(urlData, "GET", testparams);