使用REST API下载文件内容 [英] Downloading file content using the REST API
问题描述
我正在尝试使用REST API获取位于Skydrive上的文本文件的内容。
文档说明应该可以使用FILE_ID /内容作为GET的参数
"
要获取文件资源的属性,请制作一个 GET 请求/ FILE_ID (目标文件ID)。
下载内容 文件 资源,向/ FILE_ID /内容发出 GET 请求。文件内容在响应正文中返回。
要返回文件资源的下载链接,请输入 GET 使用 suppress_redirects = true 参数请求/ FILE_ID / content。该URL以
以下格式在响应正文中返回。
"
类似于
WL.api({path:fileId +" / content",method:" GET"})。then(
function(response){
$
提醒(回复);
},
; function(responseFailed){
alert(responseFailed);
}
);
他的文件内容应该在响应对象中可用。
响应对象只包含文件的下载位置而不包含内容。
任何想法?
问候
Bernhard Richter
关于Bernhard Richter
嗨Bernhard,对于REST,请尝试这样做:
GET http:// apis.live.net/v5.0/<file id> / content?access_token = ACCESS_TOKEN
I'm trying to GET the content of a text file located on Skydrive using the REST API.
The documentation states that it should be possible using the FILE_ID/content as the argument to GET
"
To get properties for a File resource, make a GET request to /FILE_ID (the target file ID).
To download the content of a File resource, make a GET request to/FILE_ID/content. The file content is returned in the response body.
To return a download link for a File resource, make a GET request to /FILE_ID/content with the suppress_redirects=true parameter. The URL is returned in the response body in the following format.
"
Something similar to
WL.api({ path: fileId + "/content", method: "GET" }).then(
function (response) {
alert(response);
},
function (responseFailed) {
alert(responseFailed);
}
);
The content of he file should be available in the response object.
The response object only contains the download location of the file and not the content.
Any ideas?
Regards
Bernhard Richter
Regards Bernhard Richter
Hi Bernhard, for REST, try this instead:
GET http://apis.live.net/v5.0/<file id>/content?access_token=ACCESS_TOKEN
这篇关于使用REST API下载文件内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!