By praxnet

2016-08-16 13:02:00 8 Comments

I am having an API-Endpoint and Authtoken for that API

the said API is for .XLS report download, how can i view the downloaded .xls file using (if possible) POSTMAN?

If it is not possible using postman what are the other programmatic ways I should be looking for?


@Jake 2016-08-16 17:54:45

Try selecting "send and download" instead of "send" when you make the request. (the blue button)

"For binary response types, you should select “Send and download” which will let you save the response to your hard disk. You can then view it using the appropriate viewer."

@SliverNinja - MSFT 2017-08-01 21:26:07

this is definitely not intuitive - thanks for the pointer! Tried Save Response but it just saved to Examples which wasn't helpful.

@jikku 2016-08-16 17:19:12

In postman - Have you tried adding the header element 'Accept' as 'application/'

@nbokmans 2016-08-16 16:40:28

If the endpoint really is a direct link to the .xls file, you can try the following code to handle downloading:

public static boolean download(final File output, final String source) {
    try {
        if (!output.createNewFile()) {
            throw new RuntimeException("Could not create new file!");
        URL url = new URL(source);
        HttpURLConnection connection = (HttpURLConnection) url.openConnection();
        // Comment in the code in the following line in case the endpoint redirects instead of it being a direct link
        // connection.setInstanceFollowRedirects(true);
        connection.setRequestProperty("AUTH-KEY-PROPERTY-NAME", "yourAuthKey");
        final ReadableByteChannel rbc = Channels.newChannel(connection.getInputStream());
        final FileOutputStream fos = new FileOutputStream(output);
        fos.getChannel().transferFrom(rbc, 0, 1 << 24);
        return true;
    } catch (final Exception e) {
    return false;

All you should need to do is set the proper name for the auth token and fill it in.

Example usage:

download(new File("C:\\output.xls"), "");

@praxnet 2016-08-16 19:34:35

This code works for me, though for my info if my endpoint would not have been direct link, what change would i need to do in above code snippet?

Related Questions

Sponsored Content

21 Answered Questions

8 Answered Questions

[SOLVED] REST HTTP status codes for failed validation or invalid duplicate

10 Answered Questions

14 Answered Questions

[SOLVED] HTTP response code for POST when resource already exists

  • 2010-09-29 21:26:13
  • vmj
  • 278361 View
  • 699 Score
  • 14 Answer
  • Tags:   http rest

7 Answered Questions

[SOLVED] How to handle many-to-many relationships in a RESTful API?

12 Answered Questions

[SOLVED] RESTful URL design for search

  • 2008-10-16 04:51:20
  • Parand
  • 175976 View
  • 403 Score
  • 12 Answer
  • Tags:   rest

12 Answered Questions

[SOLVED] REST API error return good practices

10 Answered Questions

[SOLVED] Understanding REST: Verbs, error codes, and authentication

  • 2010-01-04 19:55:36
  • Pekka 웃
  • 128587 View
  • 586 Score
  • 10 Answer
  • Tags:   web-services rest

6 Answered Questions

[SOLVED] Do sessions really violate RESTfulness?

7 Answered Questions

[SOLVED] Best practices for API versioning?

  • 2008-12-23 15:32:42
  • Swaroop C H
  • 454073 View
  • 878 Score
  • 7 Answer
  • Tags:   rest versioning

Sponsored Content