我正在尝试使用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/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 aFileresource, make aGETrequest to /FILE_ID(the target file ID).
To download the content of aFileresource, make aGETrequest to/FILE_ID/content. The file content is returned in the response body.
To return a download link for aFileresource, make aGETrequest to /FILE_ID/content with thesuppress_redirects=trueparameter. 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 apis.live/v5.0/<file id>/content?access_token=ACCESS_TOKEN
更多推荐
使用REST API下载文件内容
发布评论