Best practices for API errors management

Business Case:

KPI to be measured

Bookmark this resource Follow

Ask a question

Was this article helpful? 0 out of 0 found this helpful

When working with API, sometimes a 5xx error may occur: the causes behind these kinds of error are not connected with THRON services supply, but here you find some tips to manage them and move forward with your job.

 

In these cases, we suggest implementing a logic of retry as a best practice for these kinds of errors resolution. What is a logic of retry? It means re-calling the API for a minimum of times after the error occurs.

 

When, after invoking an API, a 5xx error occurs, we suggest to

  • adopt an exponential-backoff algorithm with a minimum number of trials between 3 and 5
  • implement the first retry not before 1 second after the error has occurred.

 

Note: in case of 4xx errors, you need to review the request and correct the error before retrying it.

 

Here you find the list of API for which we suggest to adopt a retry policy:

 

Platform API:

xadmin/resources/apps/su
xadmin/resources/apps/loginApp
xpackager/resources/repository/uploadFile
xintelligence/resources/itag/remove
xadmin/resources/content/insert
xintelligence/resources/itagdefinition/insert
xintelligence/resources/imetadatadefinition/insert
metadatadefinition/linkITag
xintelligence/resources/itag/insert
xintelligence/resources/classification/listGet
xintelligence/resources/itagdefinition/listGet
xintelligence/resources/itagdefinition/update
xcontents/resources/category/getCategory
xcontents/resources/content/updateContent
contents/resources/category/addCategoryPrettyId
contents/resources/category/createCategory
xcontents/resources/content/detail
xintelligence/resources/imetadata/insert
xsso/resources/vusermanager/detail
xadmin/resources/content/updateSource
xadmin/resources/content
xintelligence/resources/itag/bulkRemove
xadmin/resources/mediacontent/detailMediaContent
xadmin/resources/content/listVersions
xadmin/resources/content/downloadSource
xcontents/resources/contentcategory/unlink
xcontents/resources/contentcategory/link
xcontents/resources/content/search
xcontents/resources/content/addExternalId
xcontents/resources/content/removeExternalId

 

HTTP Status Code

Reason

Policy

200

OK

 

400

Invalid Arguments

No retry

418

Exception

Retry.

In case you applied a retry policy but the error keep occuring, you will need to check the body of the request.

403

Access Denied/Session Expired

In case you receive a "Session Expired" error into the ssoCode, you need to authenticate again.

404

Not Found

No retry

307

Temporary redirect

No retry

5XX

Server error

Retry

 

Products API:

/productcontentlinks
/products
/search/products

 

HTTP Status Code

Reason

Policy

200

OK

 

400

Malformed request

No retry

401

Unauthorized

You need to authenitcate before call the service.

403

Forbidden

If session is valid, this means you have no permission to perform the operation. No retry.

 

If session has expired, you need to authenticate again before retry to call the service.

404

Not Found

No retry

409

Conflict

No retry

5XX

Server error

Retry

Was this article helpful?
0 out of 0 found this helpful

Have any question?

Open a ticket
Comments