- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2017 09:29 PM
Hello,
I am very new in the web service.
I want to access a third party URL and retrieve data in json format using get method.
I have created a REST message and using get method am expecting a json format but not coming as [],but status is 200.
What the step am missing here or how can make it working
Solved! Go to Solution.
- Labels:
-
Integrations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2017 11:06 PM
Hi Saranya,
The status of 200 means a success. The response you should be able to get in logs using the below script
var r = new sn_ws.RESTMessageV2('getCartoon Number', 'get');
// set various parameters which you want
var response = r.execute();
var responseBody = response.getBody();
var httpStatus = response.getStatusCode();
gs.log(JSON.stringify(responseBody));
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2017 11:48 PM
Hello Ankur,
Thank for the reply.
I have tested with other olpn number and getting the json format.
The response coming as null [] might be missing in the external system?
Shall I request that server team to check it?
Thanks
Saranya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2017 12:31 AM
Hi Saranya,
Yes you can check with them.
One thing which you can try is copy the endpoint along with the olpn number and directly visit that endpoint in browser. In ideal case it should give some response.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2017 01:29 AM
Hello Ankur,
You are right.I have tried in the browser and there also it getting as null.
Thanks you very much for help
Thanks
Saranya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2017 04:03 AM
Hi Saranya,
One more thing you can add in the HTTP Request Header for Rest Message and Rest Message get method.
Name Value
Content-Type application/json
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2017 02:07 AM
Hi Saranya,
When you click the link, what does it show?
I guess the content is not defined, you can either specify it in the query parameter.
and hard code the "olpn" value, instead of using in url.
you can use the variable in the query parameter.
thanks,
swati