Darshan Hiranandani - How can I handle errors and exceptions gracefully in APIs?

Hi, I'm Darshan Hiranandani - How can I handle errors and exceptions gracefully in APIs? I'd love to hear your suggestions on effectively managing errors in API development!

Regards

Darshan Hiranandani

Answers

  • Isaac A.
    Isaac A. Employee
    edited 08/07/24

    Hi @surajkumarsk23!

    To handle errors and exceptions gracefully in APIs, I recommend using the error code list available in our API documentation: Smartsheet API Error Code List.

    Additionally, using Postman to test your API calls can help you analyze the possible causes of errors. Checking the Smartsheet Community for other posts related to API errors and visiting Stack Overflow to get help from other developers can also be very helpful. You can find Smartsheet API-related discussions on Stack Overflow here: Smartsheet API on Stack Overflow

    I hope this information helps!

    Cheers,

     

    Isaac.

    Need more help? 👀 | Help and Learning Center
    こんにちは (Konnichiwa), Hallo, Hola, Bonjour, Olá, Ciao! 👋 | Global Discussions

  • Alex Argumedo
    Alex Argumedo ✭✭✭✭✭

    I can only give you python references using the API but I'm pretty sure you can figure other way in different languages,

    1. use "smartsheet.errors_as_execptions(True)" then "try:" "except Exception as message" raise a message that will give you some detail of the error that you can handle as messages or emails
    2. SS has not 100% detailed messages of all error codes, so you have to play by the ear, but in general 400 check your code, 500 server side, any other is a derivate of these two
    3. use Studio Code in debug mode, it will show the error message in real time (other IDE can do it too)