REST API not able to authorize login

dshallcross
Giga Contributor

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

 

12 REPLIES 12

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 Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti

Hi, this didn't resolve the issue. The username and password are definitely correct. As I said I could login to the UI using the same details.

Vishal Jaswal
Tera 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!

Thank you for the suggestion. Unfortunately it looks like that setting in our system is set to false so shouldn't be blocking our access 

dshallcross_0-1778232693499.png