This topic illustrates the usage of the Deluge postURL task to add a new record to another Zoho Creator application. Here we use the Zoho Creator XML RPC API to add a new record.
About the application
The application Add Record using API comprises of a dummy form "POST URL" with fields "TaskName" and "TaskDescr". When the form is submitted, a new record is added to another Zoho Creator application named "task-management" with form name "Tasks" with the values entered in the dummy form.
Steps in adding a new record using the XML-RPC API
1. The POST method format to add a new record using the XML-RPC API is given below:
<form method="POST" action="http://creator.zoho.com/api/xml/write/apikey=[APIKEY]&ticket=[Ticket]"> <input type="hidden" name="XMLString" value="XML String in the format as specified in the Request format"> <input type="submit" value="Sumit XML String"> </form>
|
2. The request parameters (i.e) the application name, form name and the record values to be updated must be specified in the prescribed format:
<ZohoCreator> <applicationlist> <application name="applicationName"> <formlist> <form name="formName"> <add> <field name="fieldName"><value>fieldValue</value></field> <field name="fieldName"><value>fieldValue</value></field> <field name="fieldName"><options><option>Option 1</option><option>Option 2</option> </field> </add> </form> </formlist> </application> </applicationlist> </ZohoCreator>
|
3. In this example,
- "task-management" is the name of the application to which a new record is added
- "Tasks" is the form name with field names "Task" and "Description.
- The field value input.TaskName refers to the value specified in the TaskName field of the dummy form.
- The field value input.TaskDescr refers to the value specified in the TaskDescr field of the dummy form.
"<ZohoCreator> <applicationlist> <application name=\"task-management\"> <formlist> <form name=\"Tasks\"> <add> <field name=\"Task\"><value>input.TaskName</value></field> <field name=\"Description\"><value>input.TaskDescr</value></field> </add> </form> </formlist> </application> </applicationlist> </ZohoCreator>"
|
5. The following Deluge Script is added to the On click action of the dummy form to add a new record using the XML-RPC API. The script will be executed on click of the form button. Refer Deluge Script for the code explanation.
form Post_URL1 { displayname = "Add Record using API" store data in zc = false TaskName ( type = text )
TaskDescr ( type = textarea )
actions { On_Click ( type = submit displayname = "On Click" on click { mapvariable = map(); mapvariable.put("XMLString", "<ZohoCreator> <applicationlist><application name=\"task-management\"> <formlist> <form name=\"Tasks\"><add><field name=\"Task\"><value>" + input.TaskName + "</value></field> <field name=\"Description\"><value>" + input.TaskDescr + "</value></field></add> </form> </formlist> </application></applicationlist> </ZohoCreator>"); mapvariable.put("zc_ownername", "zc_help"); ResponseMapVariable = postUrl("http://creator.zoho.com/api/xml/write/apikey=1234&ticket=1234", mapvariable,false); ); } ) } }
|
Using Script Builder
In the Script builder we have created a map variable with the above Key and Value.

Code Explanation
- The create map task creates a new map variable named MapVariable
- The put key task adds the key, value pair to the MapVariable with values as specified by the Zoho Creator API.

- The post data posts the specified data to the external Zoho Creator application "task-management" with form name "tasks". The request url string to add a record using XML-RPC is
http://creator.zoho.com/api/xml/write/apikey=1234&ticket=1234". Users need to have an 'API Key' as well as a 'Ticket ID' for accessing the Zoho API.

- When the above script is executed, the Tasks view in the Task Management application is updated with the new record value.
Can I create bookmarklets using these APIs? so that I can post content from my browser to my zoho applications without visiting zoho. thanks!