how to attached file in a API request data with content type from-data

we need call a API with request data’s content type is from-data

In postman we can add a field to request data with type “File” and attached a file to it.

May I know how could we do so in Pega? The file to be attached can be got from local or only from case attachments?

Thanks.

@MaxonL16591286 You have to convert the Stream Content of the Attachment into byte array and pass it as a Request to the API.

  1. Set a param to data page (Param.FileContent), pass the stream content of the attachment to the param and in the request data transform set- @SetByteArray(Primary.request.body_PUT.FileBinaryContent,Param.FileContent) Based on the method… Accordingly pass the FileBinaryContent as a request to the API.
  2. Before that create a function (SetByteArray), add java code