Received 200 status code when running in REST API Explorer but 401 error code in Python

Kevin Nguyen
Kilo Explorer

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.

12 REPLIES 12

Aman Kumar S
Kilo Patron

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.

Best Regards
Aman Kumar

Hello Aman,

Thanks for the hints, I have hidden my service now instance, hope other information is enough.

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?

Best Regards
Aman Kumar

Hi Aman,

Yes, I'm using Basis Auth. Please find my profile in the attachments.