Outbound attachment using REST API POST method from Servicenow to Opesource third Party tools(Redmine): {"status":"404","error":"Not Found"}

imed1
Tera Contributor

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

1 ACCEPTED SOLUTION

imed1
Tera Contributor

The issue of 404 is fixed because the post methode not deined in the target webservice.

Best regards

View solution in original post

7 REPLIES 7

Hello,

 

Thanks for you kind replly.

 

Yes the issue is the metho not defined in the targe endpoint.

 

But now my issue is the attached received by this thrid party is crypted.

 

I send it from many file type: simple file text or picture already she received it a file contains a crypted data i have not uderstand:

i try to Encoded and Decoded it before to send it but i have already the same issue:

Bellow the code used

 

/***///

var sa = GlideSysAttachment();
var binData = sa.getBytes(current);
var encData = GlideStringUtil.base64Encode(binData);
//var DecodedBytes = GlideStringUtil.base64DecodeAsBytes(binData);

sm.setRequestBody(attch);

Also i try to use this way but also the same issue

var attch = current.sys_id;

sm.setRequestBodyFromAttachment(attch);

 

 

Best regards/

 

 

imed1
Tera Contributor

The issue of 404 is fixed because the post methode not deined in the target webservice.

Best regards

@imed 

Great!  It looks like you marked your own response as the correct answer, which may be confusing to others that read this later.

if you think there is any response that helps you please mark that helpful or accepted so that this thread can be closed.

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader