AFAIK every resource have a url in REST design. for example /user/28
is url of user with id equal to 28 and /users
will return all users.
There are some way to represent output format of the resource:
- passing a query parameter like
format
- specify it using extensions(changing
/users
url to/users.json
to get the users in json format) - specifying the requested format(xml, json, xls, ...) by setting
Accept
http header.
I search the web and it seems the correct way is setting Accept
header.
But if you want to have a http link (specified by href) to download list of users in xls format, you can't!Also if you want to download the xls by the browser, you will encounter many problems(you should use ajax so the xls should download using ajax and etc.)
If it is the best way, what is the solution for download link and if its not, which solution is better?