The CreatorCon Call for Content is officially open! Get started here.

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

midaswa
Tera Contributor

I was getting exactly the same error, error went away when I changed the format of the line

--user 'username':'password'

to

-u "username":"password"

 

Hope it helps!

Best regards

Mike