Introducing Response Error Codes

67 views
Skip to first unread message

Omar Samuels

unread,
Mar 3, 2023, 9:14:02 PM3/3/23
to todoist-api

Greetings Developers,

 

In order to facilitate better error handling and to improve the overall health of our integrations eco-system, we would like to bring to your attention a recent update to our API docs that provides more information on how to properly handle certain scenarios that may arise in the normal operations of your app.

 

A common scenario that we are observing is where a call is made to the API to apply some kind of update on behalf of a user that has been deleted, or to update a task or project that does not exist (i.e. the ID is either incorrect or the entity used to exist but has been deleted).

 

When this happens, the API will return a response status code indicating that the command execution has failed (For example HTTP Status code 404 or 403).

 

Subsequent to the failure, an error object will be provided by the API containing some useful error information that you should use to determine the next steps for your app.

 

Included in the error object will be response error codes that give more information on the reason behind the command failure.

 

As an example, let's say your integration, called "IntiGreat" makes API calls on behalf of a user that previously granted your integration the proper permissions, but then at some point afterward, the user deleted their Todoist account.  If your IntiGreat integration then makes an API call using the token for that deleted user, the command will fail and IntiGreat will receive a response with the HTTP Status code 403 and an error object containing error code 411 along with error text "User deleted".

 

The JSON error object might look something like this:

 

{
  "error_tag": "AUTH_USER_DELETED",
  "error_code": 411,
  "error": "User deleted",
  "http_code": 403,
  "error_extra": []
}


In such a scenario, IntiGreat should not retry the command and you should take the necessary steps to make adjustments on your side to update your system so that IntiGreat knows that the user has been deleted and there is no further need to make any calls on that user's behalf.

 

Details on the error codes that you may need to be aware of are available in our API docs.  We may expand that list of codes as needed in an effort to help you to optimize your integration and ensure the most delightful experience possible for our users.


We hope that you find this improvement beneficial.

 

Please take the time to review your app to see if you may need to make any adjustments in order to take advantage of this information.

 

Thank you for being such a valuable part of our community. 👍

Reply all
Reply to author
Forward
0 new messages