- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2020 06:09 AM
Hello,
Is there a way to return a binary file as output from a scripted rest API?
The file is returned from another endpoint.
I want to achieve something similar to what GlideSysAttachment().getContentStream(sys_id) and response.getStreamWrite allow.
In this case, the source file is the response from a RESTMessageV2 GET call.
I can't find a way to set the response body from the binary content.
Thanks!
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2020 09:03 PM
This post solved my problem:
https://community.servicenow.com/community?id=community_question&sys_id=f0b60b65db1cdbc01dcaf3231f96...
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2020 09:14 PM
Thanks Hitoshi.
I found a solution that saves the binary file to a SNOW attachment (using saveResponseBodyAsAttachment) and then follows the approach you mention.
I posted the link in this post.