How to troubleshoot REST API ?

ram2497
Tera Contributor

How to troubleshoot the REST API?

 

Thanks

Ram

3 REPLIES 3

Sudhanshu Talw1
Tera Guru

Hi,

Trouble shooting REST API is basically you should have idea about all the status codes.

For error codes:

https://docs.servicenow.com/bundle/london-application-development/page/app-store/good_practices/scri...

You should log status code of the response. That's a good practice to keep check did you hit the API correctly.

Following link is helpful:

https://developer.servicenow.com/blog.do?p=/tags/troubleshooting/

https://developer.servicenow.com/blog.do?p=/post/debugging-inbound-rest-calls-and-the-business-rules...

 Apart from it if you are unable to access an API, try with POSTMAN.

  

Thanks

Sudhanshu

Hitoshi Ozawa
Giga Sage
Giga Sage

For inbound REST, I usually use some tool first to test if the external REST API is actually working as it should and to confirm the parameters.

I mostly just use the curl command because I can script it and save the script so I can later use it for test.

Calling from REST API isn't too much trouble after that.

 

For outbound REST, I usually write a server script to make sure the logic is correct. Then create the API and again use curl to test the API.

To troubleshoot, I usually go back to my curl scripts and the server scripts.