The Zurich release has arrived! Interested in new features and functionalities? Click here for more

How to authenticate with REST API

David Garza
Kilo Explorer

Hello,

I have a personal developer instance of ServiceNow. That instance is using the Jakarta build. I'm trying to interact with it via the REST API.

I'm able to successfully query the incident table via the REST API Explorer. However, I'm unable to query the incident table via the REST API outside of the ServiceNow portal. I've tried querying the REST API using the code samples provided in the REST API Explorer. Specifically, I've tried using 1) the cURL command that was provided, 2) the Powershell script (which includes invalid syntax) and 3) Postman. In all three cases, I receive the following error:

401 Unauthorized
User Not Authenticated
Required to provide Auth information

I'm using the "admin" credentials for the requests. For that reason, I'm confident it has the proper permissions. In addition, I've specifically whitelisted my IP Address for thoroughness. The cUrl command I'm using looks like this:

curl "https://[redacted].service-now.com/api/now/table/incident?sysparm_limit=1" \
--request GET \
--header "Accept:application/json" \
--user 'admin':'[redacted]'

What am I missing? Why am I unable to successfully query the incident table via the REST API from cURL, Powershell, or Postman?

Thank you

 

1 ACCEPTED SOLUTION

Prateek kumar
Mega Sage

Please take a look at this doc.

https://docs.servicenow.com/bundle/london-application-development/page/integrate/outbound-rest/task/t_ConfigureRESTMsgBasicAuth.html


Please mark my response as correct and helpful if it helped solved your question.
-Thanks

View solution in original post

4 REPLIES 4

Prateek kumar
Mega Sage

Please take a look at this doc.

https://docs.servicenow.com/bundle/london-application-development/page/integrate/outbound-rest/task/t_ConfigureRESTMsgBasicAuth.html


Please mark my response as correct and helpful if it helped solved your question.
-Thanks

Alikutty A
Tera Sage

In Rest API, it don't ask you for a password. Can you reset your admin password once and try it again using Postman?

 

David Garza
Kilo Explorer

Thank you for pointing this out. This issue has been resolved.

Hi, can I ask how you resolved it?