invokeUrl Function
Table of Contents
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);