Newbie - REST API

Kdomingo
Tera Contributor

Hello and Good Evening.

 

Hope everyone is well.  Am very new to Servicenow..... created a PDI to play around and one of the things I am looking at is the ability to create/update records (incidents, requests, change orders) via webservices/REST API.  I was able to test this within the PDI via REST API Explorer however, when testing this using (perl or powershell) scripts outside of the PDI, and using the default "admin/admin" userid and password combination, I am getting the "Invoke-RestMethod : The remote server returned an error: (401) Unauthorized." error. Is there anything I have missed that needs to be configured for the "admin" account in the PDI and/or network related settings that needs to be configured to allow me to make webservices/REST API call to the PDI?

 

Thank you very much.

 

br

ken

1 ACCEPTED SOLUTION

newhand
Mega Sage

 

@Kdomingo 

I think  the script  you are running is from the  REST API Explorer page .

The script you are using is just Code Samples,so you need to change the  "admin/admin" part with your own userid and password combination.

If you don't know the  password of "admin"  , change it first  !

Please mark my answer as correct and helpful based on Impact.

View solution in original post

11 REPLIES 11

hello Sir.

 

tried postman using basic auth... and getting the same unauthorized results... may need to use/configure OATH.....

 

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

 

Best regards,

ken

Jerick I
Kilo Sage
Kilo Sage

@Kdomingo you may also refer on this community post REST API and IntegrateNow: Chapter 3 (REST API Explorer)

newhand
Mega Sage

 

@Kdomingo 

I think  the script  you are running is from the  REST API Explorer page .

The script you are using is just Code Samples,so you need to change the  "admin/admin" part with your own userid and password combination.

If you don't know the  password of "admin"  , change it first  !

Please mark my answer as correct and helpful based on Impact.

HI  @Kdomingo 

Can you just check my replay....

Please mark my answer as correct and helpful based on Impact.

Kdomingo
Tera Contributor

@newhand 

Thank you very much.

 

Tried updating the password for the "admin" user in my PDI.. plugged the generated admin password into my script as well as postman (Basic Auth).. still getting the same not authorized result.. 😞

 

Best regards,

ken