- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2017 08:20 AM
Hi,
I would like to pass JSON object to another instance which has lot of data.
Could you please tell how can we achieve it and please let us know whether object has data limit.
Suppose i want to pass following JSON object to another instance : [[" smt. 22. 11"," _1414"," Fi ewall. 24.JI A301"," 24.co e.Ajax.TD-841"," sco. 22.F12",""],["1","1","75","1","13",""],["0b1244ab4f254704de0d451f0310c7a2","3b44f10f4f298fc0de0d451f0310c797","a54ca98f4f6d0340c53eca1f0310c74f","ed0e39cb4fad0340c53eca1f0310c740","ef94331b4fe14704de0d451f0310c7ec",""]].
Thanks, Sankar
Solved! Go to Solution.
- Labels:
-
Integrations

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2017 02:03 AM
It sounds like you're sending data to the other instance with a GET method? And adding the info to the URL as a parameter?
That's not really the way you would want to send data. GET is used to ask for data. The data you are requesting comes back in the body of the response. The query paramters you add to the URL in a GET message are just a way to define a filter for the data you want to get back.
When you want to send data, you should use a POST method and put your data into the body of the message:
This way you will have less limitations on the amount of data you can send.
When using a GET method, to avoid issues with special charaters in your parameters, you may need to URI encode your parameters with encodeURI().

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2017 05:23 PM
How you do it is going to depend on what you want to do with it in the other instance. Where is it going to be stored?
Just a note on terminology:
JSON stands for JavaScript Object Notation. It means to represent a JavaScript Object as a String.
To send a JavaScript Object (or Array), over a web service, you convert it (or stringify it) to a JSON encoded String, so that it can be converted back to an Object (parsed) on the other side.
So, "JSON Object" isn't quite right. It's JSON String, or JavaScript Object.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2017 11:17 PM
Hi Geoffrey,
Thanks for reply. i want to send large string to another SNOW instance either in string format or JSON format to do some operation based on data.
Currently, we are using request.setQueryParameter to send data to another SNOW instance. But, it seems to be it has limitations like:
1) if i am sending data more than 15 thousand characters,it is giving response Bad request.
2) If i am sending special characters Like: <,> it is not sending as expected.
Thanks Again,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2017 02:03 AM
It sounds like you're sending data to the other instance with a GET method? And adding the info to the URL as a parameter?
That's not really the way you would want to send data. GET is used to ask for data. The data you are requesting comes back in the body of the response. The query paramters you add to the URL in a GET message are just a way to define a filter for the data you want to get back.
When you want to send data, you should use a POST method and put your data into the body of the message:
This way you will have less limitations on the amount of data you can send.
When using a GET method, to avoid issues with special charaters in your parameters, you may need to URI encode your parameters with encodeURI().
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2017 05:17 AM
Hi Geoffrey,
Thanks for your help, could you please help us on setHttpTimeout() issue.
We are calling REST APIs it will take more than 30 minutes to get response. However REST call is not waiting more than 5 minutes
Could you please guide us why it is not more than 5 minutes.
var request = new sn_ws.RESTMessageV2();
request.setEndpoint('https://xxxx.service-now.com/api/csga2/update_set_automation_rest/WaitTest');
request.setHttpMethod('GET');
//Eg. UserName="admin", Password="admin" for this code sample.
var user = 'xxxx';
var password = 'xxxx';
request.setQueryParameter("USlist",USlist);
request.setBasicAuth(user,password);
request.setRequestHeader("Accept","application/json");
request.setHttpTimeout(1.32e+6);
var response = request.execute();
gs.log("response : "+response.getBody());
gs.log("json : "+JSON.parse(response.getBody()));
return JSON.parse(response.getBody());