Zoho Creator - RPC APIs > XML RPC Methods > XML RPC - Add Record

XML RPC - Add Record

Tags:  

 


Add Record - XML Format


Zoho Creator XML - RPC Web API allows client applications to add record to a Zoho Creator form, using the HTTP POST method. You can add multiple records to multiple applications and multiple forms, at a time. In return the user gets a formatted XML response from the called method.  

Who can add a record ?
  • Public Form: Anyone with a valid apikey can add a record to the Form.
  • Private Form:Only the owner of the application with a valid apikey can add a record to the Form.
  • Shared Form: Any user with a valid apikey and share permission can add a record to the Form.

Request URL

The request url to add, delete or update a record in csv format is given below:


http://creator.zoho.com/api/xml/write
/apikey=[APIKEY]&ticket=[Ticket]


Request Parameters

The request parameters must be specified in the following 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>




Note:

  1. Only Deluge Script names must be specified for form names, field names and application name. Refer http://creator.zoho.com/api/reference to view the list of applications created, the form names and field names used in each application and the deluge names.
  2. You can add records to multiple applications and multiple forms at a time.
  3. Multiple picklist values must be specified within the <options> tag and each value must be specified with the <option> tag.


Sample Form ( POST Method Format )


<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 Parameterst">


<input type="submit" value="Sumit XML String">


</form>




Note:
To add records to a shared application or a public application, the zc_ownername must be specified as input to the above POST method, in the following format:

 


<input type="hidden" name="zc_ownername" value="Application Owner Name">




Sample Request

1. Sample request to add a record in a single form. The following sample adds a single record to the form named "Department" in the application named "sample".


<ZohoCreator>

<applicationlist>
<application name="sample">
<formlist>
<form name="Department">
<add>
<field name="Department_Name"><value>Payroll</value></field>
<field name="Department_Code"><value>PR</value></field>
</add>
</form>
</formlist>
</application>
</applicationlist>
</ZohoCreator>



2. Sample request to add multiple records in a form. The following sample adds two records to the form named "Department" in the application named "sample".


<ZohoCreator>

<applicationlist>
<application name="sample">
<formlist>
<form name="Department">
<add>
<field name="Department_Name"><value>Operations</value></field>
<field name="Department_Code"><value>OP</value></field>
</add>
<add>
<field name="Department_Name"><value>Administration</value></field>
<field name="Department_Code"><value>ADMN</value></field>
</add>
</form>

</formlist>
</application>
</applicationlist>
</ZohoCreator>



3. Sample request to add a record in multiple forms in the same application. The following sample adds a record to the form named "Department" and another record to the form named "Employee_Form" in the application named "sample".


<ZohoCreator>
<applicationlist>
<application name="sample">
<formlist>
<form name="Department">
<add>
<field name="Department_Name"><value>Operations</value></field>
<field name="Department_Code"><value>OP</value></field>
</add>
</form>
<form name="Employee_Form">
<add>
<field name="Name"><value>Howard</value></field>
<field name="E_mail"><value>howard@gmail.com</value></field>
<field name="Joining_Date"><value>25-Jun-2006</value></field>
<field name="Address"><value>"10, NorthWing St, NY, USA"</value></field>
<field name="Hobbies"><options><option>Reading</option><option>Singing</option></options></field>
<field name="Qualification"><value>M.C.A</value></field>
<field name="Basic"><value>50000</value></field>
<field name="Joining_Date"><value>Accounts</value></field>
</add>
</form>
</formlist>
</application>
</applicationlist>
</ZohoCreator>



4. Adding records in multiple applications. The following sample adds a record to the "Employee_Form" in the "sample application" and another record to the "Leave_Form" in the "leave-application".


<ZohoCreator>

<applicationlist>

<application name="sample">
<formlist>
<form name="Employee_Form">
<add>
<field name="Name"><value>Nicholas</value></field>
<field name="E_mail"><value>nick@yahoo.com</value></field>
<field name="Joining_Date"><value>25-jun-2006</value></field>
<field name="Address"><value>"10, NorthWing St, NY, USA"</value></field>
<field name="Hobbies"><options><option>Gardening</option><option>Music</option></options></field>
<field name="Qualification"><value>M.C.A</value></field>
<field name="Basic"><value>50000</value></field>
<field name="Department"><value>Accounts</value></field>
</add>
</form>
</formlist>
</application>

<application name="leave-application">
<formlist>
<form name="Leave_Form">
<add>
<field name="Leave_Type"><value>Leave</value></field>
<field name="From_Date"><value>20-jun-2006</value></field>
<field name="To_Date"><value>25-jun-2006</value></field>
<field name="Reason"><value>Personal</value></field>
<field name="Employee_Email"><value>john@gmail.com</value></field>

</add>
</form>
</formlist>
</application>
</applicationlist>
</ZohoCreator>



Sample Response

The response tags comprises of the form name, field values added and status message as shown in the sample format below:


<response>
<result>
<form name="Department">
<add>
<values>
<field name="Department_Code"><value>ADMN</value></field>
<field name="Department_Name"><value>Administration</value></field>
</values>
<status>Success</status>
</add>
</form>
</result>
</response>


If there is an error in the request format, the corresponding error code with the error message will be displayed. Please refer the topic, Error codes and description , to learn about the list of error code displayed.

If the record is added to the database, the response message will be displayed with status as "Success".

 


 RSS of this page