Hey,
Can anyone please help me consuming an external api with with input as .csv file .I have created the csv file using the forge component (CSVUtil). I am not sure how to pass it to the service.
Thanks,Angha
Hi Anagha.
Have you checked this one-page help to call web services and APIs?
I guess you simply need to send the CSV to the binary/text input field.
Hi,
Does your external API use form-data as input type ?
if yes, you can use plugin https://www.outsystems.com/forge/component-overview/4026/multipart-form-data
and tutorial https://www.outsystems.com/blog/posts/consuming-multipart-form-data-rest-method/
Hi Toto,
Yes the external API does use Content-Type as Multipart/Form-Data. I also downloaded the component you just shared. Do we have any sample for this particular forge component? It would be great help.
Thanks,Anagha
Yes, the plugin is a little bit tricky.
I'm sorry I cannot provide you with oml (my Webservice is private use).
First, create local variable using the structure from the plugin (Part). You need Part variable and List of Part variable (see image below)
This is how to call the web service
You need to assign the part variable with component that you need (here in my example is image)
Then append it to list of part variable
Put the MultipartFormDataCreate
Boundary = hardcoded
SyntaxEditor Code Snippet
----WebKitFormBoundary7MA4YWxkTrZu0gW
Then on the web service consume
with content-type hardcoded
"multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW"
Thanks For the reply Toto.
I used the component and what I got the response after converting it from binary to text is the below.
------WebKitFormBoundary7MA4YWxkTrZu0gWContent-Disposition: form-data; name="File"Content-Type: multipart/form-dataId,FName,LName,Email1, Anagha, Chikate, achikate@xyz.com2,Paree,Bansal,pbansal@xyz.com------WebKitFormBoundary7MA4YWxkTrZu0gW--
When I hit the service with this file in request text, its giving me 400 error.
Am I missing on something?
Thanks,
Anagha
Anagha Chikate wrote:
Id,FName,LName,Email1, Anagha, Chikate, achikate@xyz.com2,Paree,Bansal,pbansal@xyz.com
is this the file content or there is 3 parameter on webservice body ?
can you provide postman screenshot about your webservice (please blur the address, I just need to see the parameter)
Toto wrote:
These are not the parameters, this is my csv content passed in body.
If you cannot provide postman screenshot, can you provide the action ?
hey Toto,
PostEmployee is the external rest service that I am calling, which is Post type with request set to binary type.
Find the attached test oml.
Uploaded in here :-D
Hi Anagha,
In the PostEmployee, contenttype should filled with
In my case, this is the problems
Changing the content type didnt help.
Please find the attached test oml.
Anagha.
I'm waiting for the upload complete :D It seems there is a slowdown in the forum.
Yes I see that, I uploaded it twice. Please see the previous file in conversion.
Still not updated, still uploading
Ups, my mistake sorry
Let me check it.
And this is the translation from your code to the postman
is this correct ?
key : employees.csv
filename and content : employees.csv
This will translate as key
I guess that is correct.
I am hitting service A (that I have exposed) and in that service I am consuming service B (PostEmployee in the test oml), to which I want to send the employee.csv.
But its very uncommon that key is filename.
You said you expose the API? Using outsystems?
Usually expose using outsystems resulted in json type (raw json in postman)
Hello,
I am consuming a REST API where have to upload a .csv file with content type as "Multipart/form-data". We are using forge component as below and getting error as highlighted in yellow color.
https://www.outsystems.com/forge/component-overview/4026/multipart-form-data
Any help for this issue resolution will be appreciated.
Thanks & Regards,
Sachin