- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-03-2017 01:58 PM
I've been trying to learn the REST API and have hit a wall. I'm able to generate Incident and Change tickets and now I'm trying to create RITMs. I started by running some GET tests on the catalogs and categories and was successful at doing a GET /sn_sc/servicecatalog/items. When I tried to do a GET /sn_sc/servicecatalog/items/{sys_id} I kept getting a NullPointerException. Here are the details.
I started with the following GET (I'm using Postman if that matters). I have the authentication verified and all necessary roles, also verified.
https://MYINSTANCEREDACTED.service-now.com/api/sn_sc/servicecatalog/items
This gave me the expected result
Then I performed the next GET using a sys_id of an item from the result above. I also verified the sys_id in the instance from Maintain Items
I get the NullPointerException here.
Any ideas on why the GET sys_id is failing?
Solved! Go to Solution.
- Labels:
-
Integrations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2017 11:55 AM
Well, I found the issue.
Looks like there's a plugin that activated in new instances, but not ones that are upgraded. I activated these plugins and the REST calls are working now.
Thanks for everyone's help.
William
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2017 07:56 AM
Gives me the same results as:
https://MYINSTANCEREDACTED.service-now.com/api/sn_sc/servicecatalog/items
It seems like it's just ignoring everything after '...items'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2017 08:58 AM
Hi William,
Using postman i sent in a request to retrieve the item details with the following details:-
URL for Get Request - {URL}/api/sn_sc/v1/servicecatalog/items/060f3afa3731300054b6a3549dbe5d3e
Replace URL with your instance url
Then added the following headers
Accept application/json
Content-Type application/json
Then added Basic Authorization with user name and password for authentication, once you do that please press the Update Request Button in postman so that it adds a third header called Authorization with a value once you have added the basic auth details. Please ensure the user whose auth details you are entering has the read access to the record.
Now sending the Get Request would fetch you the Item details only. I was able to verify this in Postman.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2017 10:44 AM
Venkat,
That failed in my instance so I spun up a developer instance and repeated the setup and was successful. My instance is on Helsinki and the developer instance was Istanbul. The documentation suggests this is supported in Helsinki but maybe I'm wrong on that?
There's definitely something odd going on with my instance. I'm able to get some of the Service Catalog API calls to work, but not all of them.
GET /sn_sc/servicecatalog/catalogs == Success!
GET /sn_sc/servicecatalog/catalogs/{sys_id} == Success!
GET /sn_sc/servicecatalog/catalogs/{sys_id}/categories == Success!
GET /sn_sc/servicecatalog/categories/{sys_id} == Fails with "message": "Requested URI does not represent any resource: /sn_sc/servicecatalog/catalogs/e0d08b13c3330100c8b837659bba8fb4/categories/e15706fc0a0a0aa7007fc21e1ab70c2f" --- This category sys_id came from the results of the previous step.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2017 10:56 AM
Hi William,
The same call worked for me in Helsinki as well. Ensure you are using basic auth with a database password when you are using postman if you have a proxy or single sign on enabled to test the rest call.
It is ironical to see some calls go through and some not. If you have already addressed my above statement you might need a hi ticket to see what is going on..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2017 11:38 AM
Venkat,
I tested with a local user, not an LDAP user and got the same results.
Thanks for your help. I'll open a HI ticket and see where we go from there.
William