Updating Data
|
1. It is mandatory to use HTTPS in all API requests instead of HTTP request. HTTP is not supported 2. Always use https://reportsapi.zoho.com as the API request URL. |
The data present in a table can be updated using this API.
Sample
A sample request that updates the salary to 10000 and perks to 6000 and deduction to Empty (no value) for all employees of the finance department.
URL
https://reportsapi.zoho.com/api/abc@zoho.com/EmployeeDB/EmployeeDetails?ZOHO_ACTION=UPDATE&ZOHO_OUTPUT_FORMAT=XML
&ZOHO_ERROR_FORMAT=XML&authtoken=g38sl4j4856guvncrywox8251sssds&ZOHO_API_VERSION=1.0Data Sent as POST parameters.
Salary=10000&Deduction=&Perks=6000&ZOHO_CRITERIA=(%22Department%22%3D'Finance')
ZOHO_CRITERIA is encoded in URL encoding format. Value without encoding is given below:
Note |
It is recommended to use Zoho Reports Login Email Address in the API URL instead of Zoho Username. |
Specifying the action
In the query string of the URL , the ZOHO_ACTION parameter should be "UPDATE". For explanation about other mandatory query string parameters such as ZOHO_OUTPUT_FORMAT, refer this link.
Note: Value of ZOHO_ACTION parameter should be in the same case(UPPER CASE) as given in this document.
Specifying the data to be updated
Pass the columns whose values you would like to update in a <columnname>=<value> format. (The parameters should be in application/x-www-form-urlencoded format).
<columnname> - Refers to the name of the column in the table whose value is to be updated
<value> - Refers to the corresponding value to be updated in the column
For specifying empty (null) values, the parameter should be sent with empty values. In the example above, the Deduction value is taken to be empty.
Criteria
If the ZOHO_CRITERIA parameter is not sent, then all the rows are updated. If criteria is sent the rows matching the criteria alone are updated. For more details about the format for the criteria view this link.
Sample Success Response
The following code snippets provides the response in XML and JSON formats for the sample referred above.
XML
<?xml version="1.0" encoding="UTF-8" ?>
<response uri="/api/abc@zoho.com/EmployeeDB/EmployeeDetails" action="UPDATE">
<criteria>"Department" = 'Finance'</criteria>
<result><updatedColumns>
<column>Salary</column>
<column>Deduction</column>
<column>Perks</column>
</updatedColumns>
<updatedRows>4</updatedRows>
</result>
</response>
JSON
{
"response":
{
"uri": "/api/abc@zoho.com/EmployeeDB/EmployeeDetails",
"action": "UPDATE",
"criteria": "\"Department\" = 'Finance'",
"result":
{
"updatedColumns":["Salary","Deduction","Perks"],
"updatedRows":"4"
}
}
}