In rest message save response body as attachment files are getting corrupted

Kishor O
Tera Sage

save response body as attachment files are getting corrupted . Please check the below screenshots.

 

 

 

 

    request.setRequestHeader('Authorization', auth_token);
    request.setRequestHeader("Accept", "application/json");
    request.setRequestHeader('Content-Type', 'application/json');
    request.saveResponseBodyAsAttachment('u_cyderes_event', jbhsys, attachment_file_name); //
    var response = request.execute();

 

 

 

 

KishorO_0-1704389606733.png

 

3 REPLIES 3

SanjivMeher
Kilo Patron
Kilo Patron

Can you check your ecc queue, if you are getting the right response?

Also if you are receiving the data in json format, are you naming the filename correctly with the extension  .json

 

   request.setRequestHeader('Authorization', auth_token);
    request.setRequestHeader("Accept", "application/json");
    request.setRequestHeader('Content-Type', 'application/json');
    request.saveResponseBodyAsAttachment('u_cyderes_event', jbhsys, attachment_file_name+ '.json'); //
    var response = request.execute();

If not, you can add the extension as above 


Please mark this response as correct or helpful if it assisted you with your question.

@SanjivMeher I changed the code as below it is working when I am testing through background script but not working when receiving attachments from 3rd party tool.

 

     request.setQueryParameter('string_byte_data', 'true');
    request.setMIDServer('MIDServercld_dev');
    request.setRequestHeader('Authorization', auth_token);
    request.saveResponseBodyAsAttachment('u_cyderes_event', jbhsys, attachment_file_name);

 

I would suggest to check the data you are receiving via 3rd party. It mayn't be correct. try saving the data as txt and see if that works.


Please mark this response as correct or helpful if it assisted you with your question.