Desk Java SDK

Responses and Exceptions

Response

In this SDK, API requests are made through SDK methods and API responses are returned as Java objects. All API requests would return one of the following objects:

  • Data from Zoho Desk modules are returned through Plain Old Java Objects (POJO) created according to each module. You can access the values of apinames using the getter and setter methods of the POJOs.
  • For file-related API requests, such as getAgentPhoto() and getOrganizationLogo(), File objects are returned.
  • In case of API requests for which POJOs cannot be constructed (due to the uniqueness of the data), the Map<String,Object> object is returned. This includes API requests, such as updateMany() and getAccountsCount().
  • For API requests that return empty data, the boolean is returned.

Exceptions

All unexpected behaviors like faulty API responses and SDK anomalies are handled by the SDK and are indicated through the ZDeskException object. If a problem occurs while generating OAuth token or initializing the application, it is indicated through the ZohoOAuthException object.

If the response code to the API call is something other than a success code (2xx), exceptions, such as Unprocessable Entity exception and Bad Request exception, are returned. These exceptions are subclasses of the RuntimeException. Listed below are the exceptions supported in the SDK.

  • 400 - BadRequestException
  • 401 - UnauthorizedException
  • 403 - ForbiddenException
  • 404 - URLNotFoundException
  • 405 - MethodNotAllowedException
  • 415 - UnsupportedMediaTypeException
  • 422 - InvalidDataException
  • 422 - OnlyLiveChatUserException
  • 422 - IntegrationAdminErrorException
  • 429 - TooManyRequestException
  • 500 - InternalServerErrorException