Error Handling

Tags:  

Error Handling


API execution could result in Error conditions. In such cases, follow the below given steps to identify whether an error condition has occurred and to handle the same:

  • Check the http response code. If it is 4xx or 5xx (eg., 400, 500, 401 etc.,), then it is an error.
  • In case of error, the error information would be sent in the response body.
  • The format of the error content can be specified by the parameter ZOHO_ERROR_FORMAT. The value it can be either:
    • XML
    • JSON

Sample Error Response

Below snippets provide a sample error response in XML and JSON formats when there is no such table called EmployeeDetails in EmployeeDB database.

XML

<?xml version="1.0" encoding="UTF-8"?>
<response url="/api/demouser/EmployeeDB/EmployeeDetails" action="IMPORT">
<error>
<code>
7138</code>
<message>Table EmployeeDetails is not present in the database EmployeeDB</message>
</error>

</response>

JSON

{
"response":
{
"url": "/api/demouser/EmployeeDB/EmployeeDetails",
"action": "IMPORT",
"error":
{
"code":7138,
"message": "Table EmployeeDetails is not present in the database EmployeeDB"
}
}
}

    Post a comment

    Your Name or E-mail ID (mandatory)

    Note: Your comment will be published after approval of the owner.




     RSS of this page