REST API Required to provide Auth information

Kent17
Kilo Explorer

Hi,

I'm new to servicenow and I'm trying to fetch a ticket's details using the REST api. I took a look at the docs particularly this

https://developer.servicenow.com/dev.do#!/reference/api/orlando/rest/c_TableAPI#r_TableAPI-GETid

I tried to call the api using curl 

curl "https://<our-instance>.service-now.com/api/now/table/change_request/166dea65db965050c055927adb9619f6" \
--request GET \
--header "Accept:application/json" \
--user 'username':'password'

 

But it returned an error 

{"error":{"message":"User Not Authenticated","detail":"Required to provide Auth information"},"status":"failure"}

 

Can anyone help me with this or point me in the right direction on how to properly use servicenow REST APIs? Like is there a permission I need to set to my account or do I need to generate a token instead of using password? 

10 REPLIES 10

Richard45
Tera Contributor

Kent,

 

  1. Start off by confirming the username and password you have exactly matches the one on the user record.
  2. Check if the user is active and not locked out (Could be locked out if you attempted too many incorrectly)

Hi Richard,

Thank you for your reply.
1. Username and password is the one i used in the UI. Able to see the table and the ticket I wanted to see in UI.

2. It's not locked out in the UI so it shouldn't be locked out when being used in api calls right?

 

Hi Kent,

few things to check

1) since you are using OOB Table API please check these

a) the user being used for authentication has READ Access to the Table change_request

b) Check any query business rule is restricting the record visibility

c) Check the user is active and not locked out

Please check with admin credentials if this works

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi Ankur,

 

How can we check whether our account is locked out or not?