简体   繁体   中英

REST API design: the endpoint which returns a report

I need to create an endpoint which return some form of a report. Something like: api-v1/report?format=XML . And it report with custom XML-report. What should I do in case xsl? api-v1/report?format=XSL is it normal to answer on such request with XSL(Excel) file?

资源(数据)应独立于格式/编码,无论它是xml,json,xls,csv等,都应通过通常使用“ accept”标头完成的“内容协商”来确定。

一种解决方案是使用可从中下载文件的URL进行响应,而不是发送文件的内容。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM