The CreatorCon Call for Content is officially open! Get started here.

ServiceNow REST API

VishaalRanS
Tera Guru

Hello everyone.

 

To getting started on this, can you share experiences or best practices for using the ServiceNow REST APIs? What common pitfalls should developers avoid?

5 ACCEPTED SOLUTIONS

Sai_Charan_K
Kilo Sage

Hi @VishaalRanS ,

Here are some best practices which you can follow while working with ServiceNow Rest API's:

  1. Always make sure your rest api user has required access to the table and data. I would also suggest to give only " Web Service access only " to restrict the user's access to api access only.
  2. Instead of Basic auth, try using the OAuth as its more secure than Basic Auth.
  3. Always log the API failures so that you can check the issues in details when required.

Please mark this solution as "Helpful" and "accepted solution" if this solution helped you in any way.

Thanks and Regards, 
K. Sai Charan
Sr. ServiceNow Developer
Deloitte India

View solution in original post

Sai Krishna6147
Mega Guru

Hi @VishaalRanS 

When utilizing ServiceNow Rest APIs, you should adhere to the following best practices:

  1. Always make sure your rest api user has required access to the table and data. I would also suggest to give only " Web Service access only " to restrict the user's access to api access only.
  2. Instead of Basic auth, try using the OAuth as its more secure than Basic Auth.
  3. Always log the API failures so that you can check the issues in details when required.
  4. In Rest API's, the best way to practice is Http method.

Please mark this solution as "Helpful" and "accepted solution" if this solution helped you in any way.

Regards, 

Sai Krishna

 

View solution in original post

Ramesh_143
Giga Guru

Hi  @VishaalRanS , 

Please find below ref: Scripted REST API Best Practices - Quality Clouds Documentation

                                      Enhancing API Security Practices in ServiceNow (reco.ai)

                                      ServiceNow Blog | Crafting Good APIs in ServiceNow (rapdev.io)

 

Thanks & Regards,

Ramesh

Please mark this response as correct or helpful if it assisted you with your question.

 

 

View solution in original post

aryanjain25
Giga Guru

Hi @VishaalRanS 

A few practices which should be followed while working with ServiceNow REST API's:

• Use OAuth or API tokens for authentication, and avoid hardcoding credentials in your code.

• Limit API calls with pagination and query parameters (sysparm_query, sysparm_fields) to fetch only necessary data.

• Handle rate limits and timeouts by implementing retry mechanisms and monitoring API usage.

• Test in development environments before pushing to production to avoid unintentional errors.

• Log and handle errors gracefully while ensuring that permissions are properly configured for API users.

 

You can also refer the following link to understand better.

 

I would appreciate if you can mark this response as correct or helpful if it helped you with your question.

 

Thanks,

Aryan Jain

View solution in original post

5 REPLIES 5