我想知道是否有可能获取位于一个人的Google云端硬盘上的图片的URI。这是我的第一个StackOverflow问题,因此,感谢您提供任何反馈!
云端硬盘API: GET https://www.googleapis.com/drive/v2/files/{fileId}
(使用Google Docs batchUpdate ReplaceImageRequest替换图像)
uri = file["selfLink"]
=> "Invalid requests[0].replaceImage: Access to the provided image was forbidden."
uri = file["webContentLink"]
=> "Invalid requests[0].replaceImage: There was a problem retrieving the image. The provided image should be publicly accessible, within size limit, and in supported formats."
uri = file["alternateLink"]
=>(见上文)
uri = file["embedLink"]
=>(请参阅file["webContentLink"]
)
我正在尝试这些属性–期望Docs API自动解释驱动器链接。但这可能只是一厢情愿;因为它当然没有用。
我相信您的目标如下。
当使用Docs API将图像放入Google文档时,图像的URL似乎是外部URL。因此,您可以使用的URL webContentLink
。但是,该文件必须与“具有链接的任何人”作为查看者公开共享。我认为您的问题的原因是这样的。因此,请执行以下流程。
webContentLink
共享图像的URL请求batchUpdate 。本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句