Choose where you’d like to start

postUrl

Note: It is recommended to use invoke URL, since this task will be deprecated.

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.

Note: The returned response can have a maximum size of 50 mb. If this limit is crossed, a runtime error will be encountered.

Return Type

  • Text
  • Key-value

Syntax

To get the response in text or key-value format depending on the boolean value:

<variable> = postUrl( <stringUrl><body>, <boolean> );

(OR)

To post along with the header:

<variable> = postUrl( <stringUrl><body>, <headerMap>, <boolean> );
ParameterData typeDescription

<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
 }

Get Started Now

Execute