Google Drive API v3迁移 [英] Google Drive API v3 Migration

查看:132
本文介绍了Google Drive API v3迁移的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我决定从Google Drive API v2迁移到v3,这并非易事。即使Google认为这是文档,但它存在很多空白,关于这方面的信息不多



我在这里分享我发现的内容。

解决方案

首先,请阅读官方文档:迁移到Google Drive API v3






下载



下载已更改。字段 downloadUrl 不再存在。现在,它可以通过以下方式实现:

  service.files()。get(fileId).executeMediaAndDownloadTo(outputStream); 

我尝试了新字段 webContentLink ,但它返回HTML内容,而不是文件的内容。换句话说,它提供了到Drive web UI的链接。






上传



上传只需要为 create 更改单词插入,仅此而已。 >




垃圾桶/更新



我浪费了一些时间

I decided to migrate from Google Drive API v2 to v3 and it was not an easy task. Even thought Google wrote this documentation, there are many gaps in it and there is not much information about this on the web.

I'm sharing here what I have found.

解决方案

First, read the official docs: Migrate to Google Drive API v3


Download

Download has changed. The field downloadUrl does not exist anymore. Now, it can be achieved with this:

service.files().get(fileId).executeMediaAndDownloadTo(outputStream);

I tried the new field webContentLink but it returns HTML content, instead of the file's content. In other words, it gives you the link to the Drive web UI.


Upload

Upload only requires to change the word insert for create, nothing more.


Trash / Update

I wasted some time with this one

这篇关于Google Drive API v3迁移的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆