postUrl (Deprecated)
Table of Contents
Note:
- It is recommended to use invoke URL, since this task will be deprecated.
Each time the postUrl 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 postUrl 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.
Overview
The post url deluge task corresponds to a HTTP POST request. It is normally supported by services to perform write operation like adding or updating data.
Return Type
- Text
- Key-value
Syntax
To get the response in text or key-value format depending on the boolean value:
(OR)
To post along with the header:
| Parameter | Data type | Description |
|---|---|---|
<variable> (optional) | TEXT KEY-VALUE | Variable which will contain the returned response. |
| <stringUrl> | TEXT | The url which will return the response. |
| <body> | KEY-VALUE TEXT | Data to be posted. |
<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. |
Example
Lets say we have a Zoho Creator application App1 with a form named "Form1" with fields "Name1" , "Email1" and "Phone1". And, we have another application App2 with a form named "Form2" with fields "Name2", "Email2" and "Phone2". When a record is added to Form1, the same record needs to be added automatically to Form2. To achieve this we can use the following snippet in the On Success workflow of Form1.
headers = map(); headers.put("content-type", "application/x-www-form-urlencoded"); myMap = map(); myMap.put("authtoken", "<your_API_key>"); myMap.put("scope", "creatorapi"); myMap.put("Name2", input.Name1); myMap.put("Email2", input.Email1); myMap.put("Phone2", input.Phone1); resp = postUrl("https://creator.zoho.com/api/<appowner>/json/App2/form/Form2/record/add/", myMap, headers);
Response Format
Success Response
The success response when the last parameter is set to false will be returned in the following format:
"responseText": {
"formname": [
"Coupon",
{
"operation": [
"add",
{
"values": {
"ID": 3893272000000187003
},
"status": "Success"
}
]
}
]
},
"responseHeader": {
"date": "Fri, 31 Jul 2020 07:48:17 GMT",
"server": "ZGS",
"content-length": "103",
"expires": "Thu, 01 Jan 1970 00:00:00 GMT",
"x-frame-options": "DENY",
"pragma": "no-cache",
"strict-transport-security": "max-age=63072000",
"set-cookie": "JSESSIONID=CF0D0B4B9FB7B00C1685B5BB5630331A; Path=/; Secure; HttpOnly",
"x-content-type-options": "nosniff",
"x-xss-protection": "1",
"content-disposition": "attachment;filename=\"RestApi.json\"",
"content-type": "text;charset=UTF-8",
"connection": "keep-alive",
"cache-control": "no-cache"
},
"responseCode": 200
}
Failure Response
The failure response when the last parameter is set to false will be returned in the following format:
"responseText": {
"errorlist": {
"error": [
{
"code": 2892,
"appName": "App2",
"message": "Specified application name is not valid.Provide a correct one."
}
]
}
},
"responseHeader": {
"date": "Fri, 31 Jul 2020 07:15:54 GMT",
"server": "ZGS",
"content-length": "132",
"expires": "Thu, 01 Jan 1970 00:00:00 GMT",
"x-frame-options": "DENY",
"pragma": "no-cache",
"strict-transport-security": "max-age=63072000",
"set-cookie": "JSESSIONID=031ECD1F4BBFF7AB0A2F36729D54D5E0; Path=/; Secure; HttpOnly",
"x-content-type-options": "nosniff",
"x-xss-protection": "1",
"content-disposition": "attachment;filename=\"RestApi.json\"",
"content-type": "text;charset=UTF-8",
"connection": "keep-alive",
"cache-control": "no-cache"
},
"responseCode": 200
}