Response Objects
All
the API calling methods will return one of the following responses,
which serve as a wrapper objects for the Zoho CRM APIs' responses.
Responses
| Description
|
APIResponse
| Returns a single API response object.
|
BulkAPIResponse
| Returns a Bulk API response object, containing multiple objects.
|
FileAPIResponse
| Returns the file API response object.
|
A
method seeking a single entity would return APIResponse object, whereas
a method seeking a list of entities would return BulkAPIResponse
object.
APIResponse
- Use the function getData() to get the entity data from the response wrapper objects for APIResponse.
- APIResponse.getData() would return a single Zoho CRM entity object. (ex: ZCRMRecord, ZCRMModule, ZCRMField, etc..).
For example: a single record/field/module information.
BulkAPIResponse
- Use the function getData() to get the entity data from the response wrapper objects for BulkAPIResponse.
- BulkAPIResponse.getData() would return an array of Zoho CRM entity objects (ex: ZCRMRecord, ZCRMModule, ZCRMField, etc..).
For example: a multiple records/fields/modules information.
FileAPIResponse
- FileAPIResponse will be returned for file download APIs to download a photo or an attachment from a record or note such as record.downloadPhoto(), record.downloadAttachment() etc.
- FileAPIResponse has two defined methods
namely FileAPIResponse.getFileName() which returns the name of the file
that is downloaded and FileAPIResponse.getFileContent() that gives the
file content as String.
Additional Responses
Other than above response objects, there are response wrapper objects have the following properties:
ResponseInfo - any other information, if provided by the API, in addition to the actual data.
List<EntityResponse>
- status of individual entities in a bulk API. For example: an insert
records API may partially fail because of a few records. This dictionary
gives the individual records’ creation status. It is available through:
- response.getEntityResponses()
Check Exceptions
All
unexpected behaviors like faulty API responses, SDK anomalies are
handled by the SDK and are thrown only as a single exception — ZCRMException . Hence, it's enough to catch this exception alone in the client app code.