Base64 is returning null in scoped application REST API explorer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
I have scoped application. On Request I am attaching pdf file. While using GET https method in scripted REST API, I am getting null in Base64. However I am getting file name, content type, sys_id. Using below code-
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
6 hours ago
Hi @APRAJITAPAL
This issue is because you are using Packages.* in a scoped application, which is restricted and results in null / failure.
Instead of using input streams manually, use the OOTB API:
var base64 = gsa.getContentBase64(attachmentSysId);
return base64;
This works in scoped apps and avoids stream handling issues.
If getContentBase64() still returns null, then check:
- Attachment exists and sys_id is correct
- Attachment is accessible in current scope (ACLs)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
are you in scoped app or global scope?
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
