- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-26-2020 12:04 AM
Hello,
I have an issue when i want to send attachment to a third party tools (Redmine).
The third party need in the header the
Content-Type: application/octet-stream
I build my json as excpect but i my request body i have this error:
**Payload logging not supported for content-type: 'application/octet-stream'**
And i my request header i have a good json:
{Content-Length=155, Accept=application/json, Content-Type=application/octet-stream, X-SNC-INTEGRATION-SOURCE=4900085cffa314849376762fa87efe62, Authorization=Basic SU5URVJGQUNFX1NFUlZJQ0VOT1c6RjlSTzdFbVk3Ymo5bWtVTDl2cjk=, User-Agent=Jakarta Commons-HttpClient/3.1, Host=xxxxx}
In the response header i have:
Date=Tue, 25 Aug 2020 22:22:03 GMT, Server=Apache, Status=404 Not Found, X-Request-Id=1faef526-957d-4ea1-954f-0addaaaf5007, Vary=Accept-Encoding, X-Runtime=0.003372, Content-Type=application/json;charset=utf-8, Correlation-ID=, Transfer-Encoding=chunked}
Response body:
{"status":"404","error":"Not Found"}
Thanks in advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-28-2020 01:17 PM
The issue of 404 is fixed because the post methode not deined in the target webservice.
Best regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-26-2020 12:11 AM
Hi,
Is 3rd party expecting the application/type as "octet stream"
Do you have sample request and response shared by them for better understanding on how the json should look like
Usually sending attachments to 3rd party team we usually get the base64encoded data of that attachment and then send it across.
Regards
Ankur
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-26-2020 01:35 AM
Hello,
Thanks for your reply.
If i understand your idea is to encoded the attachmentand set is to the payload paremeter but also the same error:
/***
var grSysAtt = new GlideRecord('sys_attachment');
var sa = GlideSysAttachment();
var binData = sa.getBytes(current);
var encData = GlideStringUtil.base64Encode(binData);
gs.log("Encoded data:" + encData);
sm.setStringParameter('payload', encData);
**/
The client :https://www.redmine.org/projects/redmine/wiki/Rest_api#Attaching-files
after get a token I build my upload array as excpect like this:
{ "issue": { " "uploads": [ {"token": "7167.ed1ccdb093229ca1bd0b043618d88743", "filename": "image.png", "content_type": "image/png"} ] } }
Thanks for your help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-26-2020 03:07 AM
In that case you need to check whether application-type as octet-stream is supported in Outbound REST Message or not from ServiceNow.
Regards
Ankur
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-28-2020 08:49 AM
Is there any update on this? Is this question resolved or you need some more assistance.
Regards
Ankur
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader