- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-22-2018 02:49 AM
Hi experts,
I have coded a very simple RESTful post and run it in Scripts-Background.
var request = new sn_ws.RESTMessageV2('RemoteServer','Post');
request.setQueryParameter("strBase64", strBase64);
I am trying to send String "strBase64" which is Base64 encoding of an attachment.
However, looks like it has a size limitation, only a couple of KB is allowed to send.
I am quite sure that it is a service now side problem because I have also tried a Java client call and it worked.
Can anyone help?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-26-2018 12:01 AM
This issue has been solved.
Looks like Service Now has a length limitation setting on "request.setQueryParameter()", while Java doesn't.
I used setRequestBody and large content can be sent out.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-22-2018 03:49 AM
If possible can you please post the total script here
Thanks,
Siva.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-22-2018 05:36 AM
First, I would get the attachment content from sys id.
var gr = new GlideRecord("sys_attachment");
gr.addQuery("sys_id", '85b034c1dbe6e3403aff6a494896199b');
gr.query();
if (gr.next()){
var gsa = new GlideSysAttachment();
var binData = gsa.getBytes(gr);
var strBase64 = GlideStringUtil.base64Encode(binData);
}
I tried to send "strBase64" as request query parameter but if it was big(e.g., 200KB+), I would got an error and return http status with 400.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-22-2018 08:13 AM
if i am not wrong you want to send the attachment to other tool .
if yes have you tried to use "setRequestBodyFromAttachment()" .
Doc Link below
setRequestBodyFromAttachment()
Example:
Regarding the size of the request .
Hope it will help you.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-23-2018 11:15 PM
any updated on this thread?
if my response helped you then kindly mark the answer correct and close this thread.