setRequestBodyFromAttachment - How does it work?

snowenthusiast
Tera Contributor

Hi everyone,

I want to know that how does setRequestBodyFromAttachment method works? I know how to use it but I just want to know what actually happens at the backend?

var request = new sn_ws.RESTMessageV2();

request.setHttpMethod('post');

request.setEndpoint('http://myendpoint');

request.setRequestBodyFromAttachment('attachment-GUID');

request.setMIDServer('my_mid_server');

var response = request.execute();

var httpResponseStatus = response.getStatusCode();

so when I fire the above code, MID server will pick it up, fetch the attachment and POST it to the endpoint.

My question is - how does that POST happens?

  • Is it using base64 encoding?
  • Or file is streamed to the endpoint?
  • Or is it sent as a multiform data content?
  • Or something else happens?

Thanks in advance.