Table of Contents

Cloud recognition APIs error code description

Response format

All API responses use a unified JSON format. The following is an example:

{

  "statusCode": 422,

  "reuslt": "The image or meta exceeds its maximum permitted size",

  "timestamp": 1514736000000,

  "appKey": "test_app_key"

}
Field Type Description
statusCode integer Business status code. 0 means success, and non-0 means error
result string Returned content. When the status code is 0, the response is the target image object structure; otherwise, an error message is returned
timestamp long Server Unix timestamp in milliseconds
Important

Only when statusCode == 0 does result include response content. In other states, result returns an error message.

Error code categories

HTTP status code description

HTTP status code Description
200 Request succeeded, possibly containing business errors
400 Request parameter error
401 APIKey authentication failed
403 Insufficient permission or resource access forbidden
404 Requested URL interface Path does not exist
500 Server internal error
501 Application exception captured, possibly data error
502 Server unavailable, contact customer service
Note

Business errors are usually returned through HTTP 200 responses, and the specific error type is identified in the statusCode field.

Business status code list

Status Code Message
0 ok
1 invalid appId (appKey)
2 invalid signature
3 invalid date
4 appId (appKey) not exist
6 invalid token
6 invalid appkey token
7 non-sdk client for dau databases
8 Dau databases are not compatible with sense-4.6+ any more.
404 Target not found
414 Parameter required not exists or not correct
422 The image or meta exceeds its maximum permitted size
417 fail to add image
419 Cannot update target in database because similar target exists.
420 Target delete failed
424 Target enable error
403 Target already exists
426 Judge exceeds maxium candidates
427 Image not correct

Common error scenarios

Timeout without response

  • Request Timeout: the network is relatively slow. It is recommended to check the client's network environment
  • Http 401 Unauthorized: APIKey authentication failed. Check whether appId/appKey is correct
  • Status code 401: invalid application key or application does not exist. Check application configuration

Parameter errors

  • 400 Bad Request: request parameter format error
  • Status code 414: required parameters are missing or parameter values do not meet requirements

Resource operation errors

  • Status code 404: the target resource being queried does not exist
  • Status code 403: the target already exists and cannot be created repeatedly
  • Status code 417/420/424: add, delete, or update operation failed
  • Status code 422: uploaded file size exceeds the limit
  • Status code 427: image format is unsupported or the file is corrupted

System errors

  • Http 500 Internal Server Error: server internal exception. It is recommended to test on the website or with sample
  • Http 501 Exception: application exception captured, possibly data error. It is recommended to test on the website or with sample
  • Http 502 Server: service response error, possibly server error. Please contact us

Best practice suggestions

  1. Client handling: it is recommended to judge whether the business succeeded according to the statusCode field, instead of relying only on the HTTP status code
  2. Error retry: retry appropriately for 5xx errors, and check request parameters for 4xx errors
  3. Log recording: it is recommended to record the complete error response for troubleshooting
  4. Timeout handling: set a reasonable request timeout to avoid long waits