In rest message save response body as attachment files are getting corrupted
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2024 09:36 AM
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();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2024 10:03 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2024 10:12 AM
@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);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-04-2024 10:39 AM
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.