Khaled-AS
(Khaled Abdel Salam)
December 16, 2019, 1:03pm
1
We’re using HTTP Request to call the REST API.
The REST API, POST, has a response with an attachment file.
How can we download this file and save it.
We tried to use ResourcePath property, but it seems it stores all the response of the API, not the attached file itself.
Thanks in Advance…
bcorrea
(Bruno Correa)
December 16, 2019, 7:26pm
2
i guess it depends on your request, which is the response format?
Khaled-AS
(Khaled Abdel Salam)
December 16, 2019, 7:27pm
3
The response format is multipart/mixed and the attachment is csv file.
bcorrea
(Bruno Correa)
December 16, 2019, 7:29pm
4
and it is really a POST to receive a file??
Khaled-AS
(Khaled Abdel Salam)
December 16, 2019, 7:36pm
5
Actually, It POST around 200 transactions. The received file is summary of these transactions including the status of each transaction.
For example, these transactions are invoices, we create the invoices, at tax then validate them.
Khaled-AS
(Khaled Abdel Salam)
December 16, 2019, 8:03pm
7
Ya, I tried it. It maps to the property of ResourcePath.
All the response gets loaded at the specific path, not only the attachment file.
For example:
------=_Part_124_1858720322.1576525050413\r\nContent-Type: application/json\r\n\r\n{ "invoicesCount" : 24, "invoicesFailed" : 0, "invoicesSucceeded" : 24}\r\n------=_Part_124_1858720322.1576525050413\r\nContent-Type: text/csv\r\nContent-Disposition: form-data; name="OracleCreatedInvoices.csv"; filename="OracleCreatedInvoices.csv";
BUSINESS_UNIT,INVOICE_NUMBER,AMOUNT,CREATION_STATUS,VALIDATION_STATUS
TEST57-INT-ANN-SEP-19-P013401,42517.88,SUCCESS,Needs revalidation\nESEC - BU2,TEST57-DOM-BUS-SEP-19-P013401,1424.85,SUCCESS,Validated\nESEC - BU2,TEST57-DOM-EXT-SEP-19-P013401,413.7,SUCCESS,Validated\n\r\n------=_Part_124_1858720322.1576525050413–\r\n",
“level”: “Information”,
“logType”: “User”,
“timeStamp”: “22:39:02”,
“processVersion”: “1.0.0”,
“jobId”: “a9f9bdaf-d4b7-4925-8ab3-6cc3d31b9033”,
“machineId”: 0
}
bcorrea
(Bruno Correa)
December 16, 2019, 8:07pm
8
this response do not seem to have the file as binary, but its contents are inside it, did you parse this response as json and examine the object to see the easiest way to get the content of the csv.
Khaled-AS
(Khaled Abdel Salam)
December 16, 2019, 8:15pm
9
I can try parsing it to get the json response and csv contents separately.
But the point, when I try the API from SoapUI or Postman, I’m able to get the contents of json and the attached file separately.
bcorrea
(Bruno Correa)
December 16, 2019, 8:18pm
10
i would try it for you using the uipath activity but i dont have a service to test the results…
Khaled-AS
(Khaled Abdel Salam)
December 16, 2019, 8:24pm
11
No worries bcorrea, appreciating your responses and suggestions.
I’ll parse the response to get the needed data.
Many thanks…
1 Like
system
(system)
Closed
December 19, 2019, 8:24pm
12
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.