BookmarkSubscribeRSS Feed
Choose Language Hide Translation Bar
uday_guntupalli
Community Trekker

Re: API Response Encoded as Gzip

@bryan_boone
                 All the messages return the same error . When I try to download the file as @Craige_Hales recommended, it works fine, but none of the diagnostic functions yielded any result     image.png

Best
Uday
0 Kudos
Highlighted

Re: API Response Encoded as Gzip

What you have in your code is that Request is the result of Send.
I *think* what you want is:

request = New Http Request(
URL( URLDes),
Method("GET"),
Headers({HeaderStr})
); //request is the request object
data = request << Send(); //data is the data returned by the web server



That way you can examine the status of request after you've interacted with the service.
I generally think about HTTP Request stuff in 3 steps
Create
Configure
Send

0 Kudos
uday_guntupalli
Community Trekker

Re: API Response Encoded as Gzip

@bryan_boone,
               Thank you for that. 

image.png

 

While this is helpful to some degree, I don't see a way other than downloading the data, to de-compress it and interpret within JMP, is my interpretation correct  or do you have any other approaches ? 

Best
Uday
0 Kudos

Re: API Response Encoded as Gzip

You can still use Download instead of Send.
What the above shows is that you have gotten a complete download from your web service. (which is good)

to use Download instead of Send, you can do this:

filename = request << Download("$temp/Test1.xlsx", "replace"); //file is the filename returned by the web server. replace will replace it.
if( !IsEmpty(filename), //a filename is empty if the download fails
//process your file
);



In your case, the mimetype is "text/html" and not an excel spreadsheet. You just named it with and xlsx extension.
If your web service has a different endpoint for excel spreadsheets, use that.
or
If your web service uses and "Accept" header to specify an excel spreadsheet, use that
otherwise
Open the file with a text editor to see what it is. (or a browser) According to the mimetype, you downloaded html.

Re: API Response Encoded as Gzip

@uday_guntupalli

That's a great usage for having

HTTP Request << Send accept, say, "blob" or "text" arguments.
We'll look into it for JMP 15.  Do you want to add it as a Wish List item?

Thanks

-Bryan

uday_guntupalli
Community Trekker

Re: API Response Encoded as Gzip

Of Course @bryan_boone. I love to contribute to making JMP better and easier, so it makes our lives easier :) :) 

Best
Uday
0 Kudos