- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-28-2017 10:24 AM
Hi, I'd like to send an attachment from ServiceNow to an external system - ZenDesk. This first requires the file to be uploaded using HTTP POST.
I was using the RestMessageV2 api - it works for text but not for binary. I guess the binary data is being corrupted by the Java String due to invalid UTF.
The curl example is below (and here ). It uses a pure binary format (application/binary), and specifically does not interpret base64 , MIME etc.
curl "https://{subdomain}.zendesk.com/api/v2/uploads.json?filename=myfile.dat" \
-v -u {email_address}:{password} \
-H "Content-Type: application/binary" \
--data-binary @file.dat -X POST
(Out of curiosity I did try to POST a mutlpart/form-data to ZenDesk using Curl but ZenDesk just interpreted the entire message as the file including control codes)
I've looked briefly at the httpClient classes:
- Packages.org.apache.commons.httpclient.HttpClient();
- GlideHTTPClient();
But I've seen comments that the latter only exposes string functions.
I've seen some info on saveResponseBodyAsAttachment() I guess I'm looking for something like sendAttachmentAsRequestBody()
or ideally just a way to do a simple pure binary HTTP post.
Any ideas ?
I've also looked from the ZenDesk end, to see if it can accept Base64/Mime but there does not seem to be any options there (No SOAP API etc)
Solved! Go to Solution.
- Labels:
-
Integrations
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-01-2017 01:16 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-01-2017 12:55 AM
Hi Andrew,
Have you checked this?
GlideSysAttachmentInputStream
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-01-2017 01:04 AM
Hi Srini, yes I've seen that. That is for binary on the response,, I want to send binary on the request.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-01-2017 01:16 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-01-2017 01:35 AM
Hi Looks promising but according to this ( setRequestBodyFromAttachment - How does it work? ) it sends Base64 ? Can you confirm? I need a pure binary post...