HTTP Request Get Result Document

Hi,
I’m using http request activity to get documents from url.

The problem is that I don’t know the extension (.pdf, .xlsx, .doc) of the reponse.

It’s possibile to save the result with the extesion rerturned from http request ?
What’s the value I have to write in the ResourcePath property ?
Tkx

1 Like

Hi @Bucci,
Welcome to the Community!
Each document has it’s own markers in raw code.
Example:

PDF

image

HTML

image

DOC

image

XLSX

image

Maybe you could base on this to determine the file extension.

thanks Pablito,
how can I read the raw code ?

Hi @Bucci,

Can you post the response you got if possible?

May be the response contains certain key words like “file”, “status”, “result” or whatever it is.
If you are getting the response, then the file name should include in any of the headers or the response

Can you tell me the example of address you are using for Http Request activity? Normally if web address is pointing to particular file it has it’s extension at the end of address.

Hi HareeshMR,
I don’t know how get the response. Shall you help me please ?
I’m using HTTP Request Activity and I don’t know what’s the parameter/value I have to get the rensponse

thx

Hi Pablito, the request has only a key to get the document, without extension or file type

@Bucci ,

Create variables in the headers and result. try to print them using message box. Take screenshots and post them…

image

Hi,
using a message box: with some test case UiPath crash.

I try to invoke manually (with the wizard) and I understand that I need to read Content-Type.

For Example

Response Status: Completed
Status Code: 200
Content-Type: message/rfc822;charset=utf-8

or

Response Status: Completed
Status Code: 200
Content-Type: application/pdf;charset=utf-8

There is any way to read Content-Type from the http response?

You are passing the content type as header to the request, then output will with the extension you passed to the request.

If you are trying to download the file without sending any content type header, then you may get it in the output headers.

Can you try saving the output headers and output result after the request (Not in Preview Request)

1 Like

I have a problem … I don’t have option to write output headers into a variable and yes I’m
trying to download the file without sending any content type header

That’s strange thing . Can you try upgrading or downgrading the http activities?

I try … I don’t have output headers field

Which version of UiPath you are using? And what is the version of UiPath.web.activities?

@Bucci

UiPath version: 2017.1.6435
UiPath.web.activities: 1.4.1.0

If I try to Update I have the error message below

The latest version is 1.4

image

Hi,
I solved the problem reading the first 4 byte of the stream returned as a file

Thank’s for all your help

2 Likes

I have the same issue. Can you expand on how you solved this?