403 forbidden response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-10-2016 09:28 AM
Hi,
I am trying to create an incident using my instance.
HttpPost httpPost = new HttpPost("https://myinstance.service-now.com/api/now/table/incident");
httpPost.setHeader("Accept", "application/json");
httpPost.setHeader("Content-Type", "application/json");
HttpEntity entity = new ByteArrayEntity(postData.getBytes("utf-8"));
httpPost.setEntity(entity);
System.out.println("Executing request " + httpPost.getRequestLine());
CloseableHttpResponse response = httpclient.execute(httpPost);
try {
System.out.println("----------------------------------------");
System.out.println(response.getStatusLine());
String responseBody = EntityUtils.toString(response.getEntity());
System.out.println(responseBody);
} finally {
response.close();
}
I get a 403 forbidden response back from the webservice.
HTTP/1.1 403 Forbidden
{"error":{"message":"Operation Failed","detail":"Error during insert of incident (INC0000001)"},"status":"failure"}
Not sure where is it going wrong. I am sending the json in the postData variable. Not sure if it is the input json data which is causing the issue.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-13-2016 09:44 PM
403 is a forbideen error generally has to do with authentication. You didn't say anything about authentication. Are you able to query a table with a GET using the same headers?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-19-2016 04:55 PM
Yes, It is definitely related to authentication, actually the ACL related authentication. I am able to do a GET request and successfully get a response. I have tried adding access specific roles to the USER and also matched the roles of user with table ACL list. I either get 403 forbidden or 401 user not authorized. This is on my second instance, the first instance works fine.
Thanks,
Priyank

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2016 05:59 PM
I know I said it before. Are you declaring the auth ahead of time or did you just exclude the header "Authentication: Basic _BASE64dusername:_password" against the problem instance? Could it also be that you tested the first instance after you auth'd in a different script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2016 02:52 PM
Right now I dont have the auth header, it used to work before without adding the entry to the header. what exactly do I need to do to add it to the header.
Thanks,
Priyank