REST API not able to authorize login

dshallcross
Kilo Explorer

We are looking to extract data via the REST API. When attempting to do we are presented with a 401 error in postman and also other methods of calling the endpoint.  We are definitely using the correct username and password via basic auth. Co-pilot suggests it could be a permissions setup as we are using SSO for other accounts in the business. Could this be possible? How do I stop SSO interfering with the service account calling the API endpoint. This is unlike the other like this in the community forum, we don't wish to extract data from dev.

This is the endpoint being attempted api/now/table/sys_user?sysparm_limit=1

Example error

dshallcross_0-1778161704561.png

 

7 REPLIES 7

Sometimes if I wait 10 mins it will work but the stop working again when directly using the endpoint url and logging in to get the results. Not worked yet in postman however

Hi @dshallcross 

Sometimes if you have keyboard issue, may be typing not work properly.

 

First try to open end point with that credential (TESTING). If working->Type in notepad and from there paste in postman.

 

 

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin:

Vishal Jaswal
Giga Sage

Hello @dshallcross 

Navigate to All > System Web Services > API Access Policies > REST API Access Policies (Table Name: sys_api_access_policy) and find out whether Table GET API Access Policy is set to Active as True or False:
If True as shown below, then you can get 401 error:

VishalJaswal_1-1778167719312.png

VishalJaswal_2-1778167818546.png

Sometimes if I wait 10 mins it will work but the stop working again when directly using the endpoint url and logging in to get the results.  -> Because browser can use existing SSO web session. 


Hope that helps!