使用REST API下载文件内容

编程入门 行业动态 更新时间:2024-10-18 20:25:58
本文介绍了使用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/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下载文件内容

本文发布于:2023-11-28 09:59:44,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1641942.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件   内容   REST   API

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!