- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2015 08:12 AM
Hi,
I'm trying to test the REST API in order to send requests on the incident table.
Each day I create a test user with the "rest_service" profile on Service Now's sandbox : ServiceNow
I was able to create incidents successfully for 2 days.
But now I get the following error in RESTClient
- Status Code: 401 Unauthorized
- Connection: close
- Content-Encoding: gzip
- Content-Type: application/json
- Date: Fri, 09 Jan 2015 15:54:02 GMT
- Server: ServiceNow
- Transfer-Encoding: chunked
- WWW-Authenticate: BASIC realm="Service-now"
Thanks,
Sovanna
Solved! Go to Solution.
- Labels:
-
Integrations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2015 02:25 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2015 02:09 AM
Use one of the demo instances:-
URL: https://demo006.service-now.com/login.do
username:admin
password:admin
Create a user profile with rest_service,itil roles. Try the post method onto this instance. See if it works.
Regards,
Hari
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2015 02:25 AM
Works fine on this instance!
Thanks Hari!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2015 02:30 AM
no problem .would you mind closing off this thread please.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2016 02:59 PM
I'm getting 401 Unauthorized error too when using API in development instance (Helsinki). Under roles, rest_service role description says "Deprecated. This role is no longer required to access the REST API." When creating the user I'm using to connect, I did make sure it has "Web service access only" checkbox checked.
$(document).ready(function () { //get token var snOauthClientId = 'my_client_id'; var snOauthSecret = 'my_secret'; $.ajax({ url: 'https://dev_instance.service-now.com/oauth_token.do?grant_type=password&client_id=' + snOauthClientId + '&client_secret=' + snOauthSecret, type: 'POST', dataType: 'jsonp', success: function (data) { authToken = 'somevalue'; console.log(JSON.stringify(data)); }, beforeSend: setHeader, error: function () { alert('Failed!'); } }); }); function setHeader(xhr) { var snRESTUser = 'username'; var snRESTPwd = 'password'; xhr.setRequestHeader("Authorization", "Basic " + btoa(snRESTUser + ":" + snRESTPwd)); xhr.setRequestHeader('Accept', 'application/json'); xhr.setRequestHeader('Content-Type', 'application/json'); }