Received 200 status code when running in REST API Explorer but 401 error code in Python
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-15-2022 08:55 PM
Hello ServiceNow community,
I'm having an issue when running APIs from ServiceNow UI:
1. I tested API with UI -> System Web Services -> REST API Explorer and it returns status code 200.
2. But when I used the code sample from UI (Python) and inputted to ATOM to run (already changed username and password), I received error code 401 although I had the necessary roles for my account.
Please help me with this issue.
Thank you.
Best Regards.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-15-2022 09:01 PM
Hey Kevin,
I can see few identifiers in your request, please hide or blur them, I think it is sensitive data and could land you in trouble if somebody spots those.
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-15-2022 09:05 PM
Hello Aman,
Thanks for the hints, I have hidden my service now instance, hope other information is enough.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-15-2022 09:07 PM
As far as your question, is concerned, it seems like an issue with credentials only
What authentication type you are using, it seems to me basic auth since you are using username and password.
Few things to check, are you explicitly passing for basic auth, also if your user has relevant roles to access cmdb table, can you share the user profile that you are using, is it a web service user or not?
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-15-2022 09:17 PM