- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2023 03:48 AM
Hello,
I am testing the Attachment API (Upload an attachment from binary request (POST) with the "Rest API Explorer" module to see if it works correctly for my needs.
I uploaded a file from my computer (local) and when I try to send, it works well.
Now my question is How can I attach a file from a URL instead of uploading it locally? I have a URL with a PDF file and I want to attach this file to the HR Case form.
Thank you
Solved! Go to Solution.
- Labels:
-
Human Resources Service Delivery
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2023 04:15 AM - edited 08-30-2023 04:16 AM
Hello @Andr_1 ,
I think you might have to do it via script using RESTMESSAGEV2 API like below
var attachmentMessage = new sn_ws.RESTMessageV2();
try {
attachmentMessage.setHttpMethod("get");
attachmentMessage.setEndpoint(targetInstanceURL);
attachmentMessage.saveResponseBodyAsAttachment("incident", {record sys_id}, {filename});
var response = attachmentMessage.execute();
var httpStatus = response.getStatusCode();
} catch(ex) {
gs.info("ERROR (sendAttachments): " + ex);
}
}
Note :This is untested , but try giving it a shot .If it works let me know
Replace targetedInstanceURL with your Teams link
If this helps
Mark the answer correct
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2025 01:10 PM
Hello @Mohith Devatte
I can confirm this will work as long as you have the file full URL 🙂
Thank you for your sharing
