Credentials for Basic authetication to test the REST API

mstancheva
Tera Contributor

Used credentials to test the API are admin:admin. But I often receive Not Authorized Exception.

Are there other credentials that can be used?

Best regards,

Mihaela Stancheva

6 REPLIES 6

sergiu_panaite
ServiceNow Employee
ServiceNow Employee

Hi Mihaela,



If the password for 'admin' user changed then you can get the exception. If you're using a script to test the REST API you need to adapt user/password to a user that has access via REST.


Alikutty A
Tera Sage

How are you testing the APIs? Using REST API explorer or any external tools?



You can try resetting admin password and try it again. For some tables, ACL's also block access for admin users.



Thanks


Please Hit like, Helpful or Correct depending on the impact of the response


gerritkuilder
ServiceNow Employee
ServiceNow Employee

Hello Mihaela,



I assume you are testing with one of the example scripts generated when testing the API, these scripts all use admin:admin as username/password but you have to update with a real username password combination. (so it has to be a user that is in the instance and has rights to do the things you want to do.



Link to the documentation (ensure that you use the correct version, this is for Istanbul) REST API security



Kind Regards,



Gerrit Kuilder


Technical lead Integrations EMEA


Thank you very much for the information. I am testing GRUD operations on insidents and user tables through the POSTMAN using REST API.


And if I do simultaneous calls through java spring RestTemplate with Basic Authentication using admin:admin some of the calls return Not Authorized and after a Refresh the call response is 200OK. So once the call is successfull other time it is unauthenticated. To clarify I am working with the demo environment tables defined from the wiki page.


Regards,


Mihaela