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",
}]
}
Content-Type: application/pdf
Content-Disposition: file; filename="test1.pdf";documentid=1
<documents removed>
--AAA--
I had this exact question and found the example João Rosado mentioned in the Box connector (https://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";
{ "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" } }
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:
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.
Hi Jasper,
I solved my problem. Let me know how your request looks like and I can try to give you the solution.
Hi Suraj,
This is the AJAX export from a working POSTMAN example I'm trying to get to work in OutSystems:var form = new FormData();form.append("options", "{\"period\":\"12\"}");form.append("texts", "1,2,3,4,5,6,7,8,9,10,11,12,1,2,3,4,5,6,7,8,9,10,11,12,1,2,3,4,5,6,7,8,9,10,11,12");var settings = { "async": true, "crossDomain": true, "url": "https://sandbox.api.sap.com/ml/timeseriesforecast/inference_sync", "method": "POST", "headers": { "Accept": "application/json", "Content-Type": "application/x-www-form-urlencoded", "APIKey": "<<APIKey>>", "Cache-Control": "no-cache", "Postman-Token": "6c8d62d3-5f9f-6e35-3540-8bea752ea560" }, "processData": false, "contentType": false, "mimeType": "multipart/form-data", "data": form}$.ajax(settings).done(function (response) { console.log(response);});
Hope you have a solution for this in OutSystems.
Perhaps you can take a look at this topic, someone's having the same problem.
@Kilian sir,
That guy is from my company only and I am the one who has given him the code to consume that web service. I will debug his code to check what he is doing wrong.
@Jasper: I will try to check with this info provided but if you can provide request payload from API documentation that would be helpful.
Can you please create a sample for multipart data it will be helpful for us.
Regards
-SK-
@Suraj thanks!
I tried consuming that but it's giving me an invalid API Key error. If you don't mind, can you please share the API Key so that I can test properly.
If that is not possible, from postman send me Http export code generated instead of ajax export code.
Sorry, I can not give you the APIKey because it's connected to my personal account at SAP Leonardo Machine Learning services. But below is the HTTP export of Postman, thanks in advance!!!
POST /ml/timeseriesforecast/inference_sync HTTP/1.1Host: sandbox.api.sap.comAccept: application/jsonContent-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gWAPIKey: <<apikey>>Cache-Control: no-cachePostman-Token: 97a334ee-bfa4-2716-8a5e-2cd80cc58499------WebKitFormBoundary7MA4YWxkTrZu0gWContent-Disposition: form-data; name="options"{"period":"12"}------WebKitFormBoundary7MA4YWxkTrZu0gWContent-Disposition: form-data; name="texts"1,2,3,4,5,6,7,8,9,10,11,12,1,2,3,4,5,6,7,8,9,10,11,12,1,2,3,4,5,6,7,8,9,10,11,12------WebKitFormBoundary7MA4YWxkTrZu0gWContent-Disposition: form-data; name="files"{{files}}------WebKitFormBoundary7MA4YWxkTrZu0gW--
Really sorry for the late reply. I was stuck in other problems.
PFA oml for the http request shown above.
On page ConsumeAPI there's one action and I have added the code there with comments. Try with this and let me know if you are able to consume it.
If you want to discuss, we can have a quick skype call.
Cheers!!
I'm also late with my reply :)Many thanks! I'm going to test it in this evening! Will let you know if it worked for me!
Regards,
Jasper
Hello,
For those who may be still facing this issue: I've published a Forge component which helps submitting multipart/form-data content.
https://www.outsystems.com/forge/component/3731/multipart-upload/
Thanks.
For anyone who comes across this topic, here's an Idea to have OutSystems support it natively. Please like :).