Rest Api "multipart/form-data"

Rest Api "multipart/form-data"

  
Hi,

How can I convert this content to outsystems rest api

Accept: application/json

Content-Type: multipart/form-data; boundary=AAA

 

--AAA

Content-Type: application/json

Content-Disposition: form-data

{

  "status":"sent",

  "emailBlurb":"Test Email Body",

  "emailSubject": "Test Email Subject - EnvelopeDefFull",

  "documents": [{

      "name": "test1.pdf",

      "documentId":"1",

      "order":"1"

  }],

  "recipients": {

    "signers" : [{

      "email": "m.rosey@thomasind.com ",

      "name": "Mike Rosey",

      "recipientId":"1",

    }]

  }

}

--AAA

Content-Type: application/pdf

Content-Disposition: file; filename="test1.pdf";documentid=1

 

<documents removed>

 

--AAA--

You need to have a single definition, so include the PDF into the form data.
Hi Ozkan,

There are some examples like that in the forge. Try checking the Box or the Dropbox components, pretty sure one of them need it as well.
Multipart requests are not out-of-the-box, they need to be done using the OnBeforeRequest or OnBeforeRequestAdvanced callbacks to change the body binary directly.

Regards,
João Rosado

I had this exact question and found the example João Rosado mentioned in the Box connector (http://www.outsystems.com/forge/component/586/box-connector/).

This connector's FileUpload method can be copied and adapted for other multipart/form-data scenarios.

Sorry guys, I am opening old thread but I am facing same problem with upload file.

I have REST API like this

POST /rest/bfo/mycase/2.0/cases

Authorization: Bearer 6f0aab651234e57b4ba4567da3f47a

Content-Type: multipart/form-data; boundary="boundary_string"

X-SE-IFW-BFOAccessToken: 00D17000000A1E7!ARwAQAp0ALjoR_.X6Q9GVFcHUxOxWkT0cGvZnTnzNISZMbzihsFyWWxTCYmzSEhxplVviv8j0dQpY.jCa2aFxBRNpZ67M3Gf

X-SE-IFW-ApplicationName: CCCAPP

X-SE-IFW-CountryCode: FR

X-SE-IFW-LanguageCode: EN

X-SE-IFW-RequestId: 10001

--boundary_string

Content-Disposition: form-data; name="entity_document";

Content-Type: application/json

{
 "portalId": "Meter Insights",
 "sendAutoGeneratedEmail": "false",
 "caseInformation": {

      "accountId": "0011100001OfIAeAAN",
 "subject": "RegisterCaseTesting",
 "customerRequest": "Testing",
 "category": "Pricing and Availability",
 "reason": "Comments",
 "severity": "Normal",
 "status": "New",
 "priority": "Normal",
 "origin": "Phone",
 "type": "Feature Request",
 "CCTeam": "CCC-MobileApp",
 "CCCountryCode": "FR",
 "callBackNumber": "7410258963",
 "productReference": "Prod133",
 "materialDescription": "MD0032",
 "symptom": "working"
 },
 "caseOwner": [
 "SESA56238"
 ],
 "webInformation": {
 "name": "saleha",
 "emailAddress": "saleha_saheen@thbs.com",
 "phone": "9945678432",
 "company": "Thbs",
 "country": "Japan",
 "language": "Japanese",
 "jobTitle": "Software Engineer"
 },
 "additionalDetails": {
 "quantity": "1.0",
 "serialNumbers": "1234",
 "dateCodes": "20151212",
 "operatingSystem": "Windows8",
 "softwareVersion": "1.0"
 }
 }

--boundary_string

Content-Type: text/plain

Content-Disposition: form-data; name="Body"; filename="api-test.txt"

Binary data of the file goes here

--boundary_string--

Can you help me how should I implement this. 

@Joao, I tried that action from FileUpload but I am unable to do it. Can you please write one action for me to consume this API.

Thanks and Regards,

Suraj Borade

Suraj Borade wrote:

Sorry guys, I am opening old thread but I am facing same problem with upload file.

I have REST API like this

POST /rest/bfo/mycase/2.0/cases

Authorization: Bearer 6f0aab651234e57b4ba4567da3f47a

Content-Type: multipart/form-data; boundary="boundary_string"

X-SE-IFW-BFOAccessToken: 00D17000000A1E7!ARwAQAp0ALjoR_.X6Q9GVFcHUxOxWkT0cGvZnTnzNISZMbzihsFyWWxTCYmzSEhxplVviv8j0dQpY.jCa2aFxBRNpZ67M3Gf

X-SE-IFW-ApplicationName: CCCAPP

X-SE-IFW-CountryCode: FR

X-SE-IFW-LanguageCode: EN

X-SE-IFW-RequestId: 10001

--boundary_string

Content-Disposition: form-data; name="entity_document";

Content-Type: application/json

{
 "portalId": "Meter Insights",
 "sendAutoGeneratedEmail": "false",
 "caseInformation": {

      "accountId": "0011100001OfIAeAAN",
 "subject": "RegisterCaseTesting",
 "customerRequest": "Testing",
 "category": "Pricing and Availability",
 "reason": "Comments",
 "severity": "Normal",
 "status": "New",
 "priority": "Normal",
 "origin": "Phone",
 "type": "Feature Request",
 "CCTeam": "CCC-MobileApp",
 "CCCountryCode": "FR",
 "callBackNumber": "7410258963",
 "productReference": "Prod133",
 "materialDescription": "MD0032",
 "symptom": "working"
 },
 "caseOwner": [
 "SESA56238"
 ],
 "webInformation": {
 "name": "saleha",
 "emailAddress": "saleha_saheen@thbs.com",
 "phone": "9945678432",
 "company": "Thbs",
 "country": "Japan",
 "language": "Japanese",
 "jobTitle": "Software Engineer"
 },
 "additionalDetails": {
 "quantity": "1.0",
 "serialNumbers": "1234",
 "dateCodes": "20151212",
 "operatingSystem": "Windows8",
 "softwareVersion": "1.0"
 }
 }

--boundary_string

Content-Type: text/plain

Content-Disposition: form-data; name="Body"; filename="api-test.txt"

Binary data of the file goes here

--boundary_string--

Can you help me how should I implement this. 

@Joao, I tried that action from FileUpload but I am unable to do it. Can you please write one action for me to consume this API.

Thanks and Regards,

Suraj Borade

Have you already solved this Suraj? I'm also having trouble consuming a POST service using "multipart/form-data".


Hi guys.

It's possible to build a multipart/form-data request by constructing the binary payload by hand. I saw this being done in some components such as the Asana Connector for uploading attachments to Asana tasks. Download it and inspect the code to see how to invoke such a service.