Google drive api elixir将文件上载到google drive
我遵循谷歌驱动api的指示 这是我的请求主体Google drive api elixir将文件上载到google drive,google-drive-api,elixir,Google Drive Api,Elixir,我遵循谷歌驱动api的指示 这是我的请求主体 multipart_request_body = --1234567 Content-Type: application/json { name: "text.csv", mimeType: "text/csv"} --1234567 Content-Length: 18 Content-Type: text/comma-separated-values Content-Transfer-Encoding: binary id,promo\
multipart_request_body =
--1234567
Content-Type: application/json
{ name: "text.csv", mimeType: "text/csv"}
--1234567
Content-Length: 18
Content-Type: text/comma-separated-values
Content-Transfer-Encoding: binary
id,promo\n1,asdadas
--1234567--
和标题
headers = [{"Content-Type", "multipart/related; boundary=1234567"},
{"Content-Length", byte_size(multipart_request_body)},
{"Authorization","Bearer #{access_token}"}]`
和url
api_url = "https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart"
我正在使用HTTPoison
发出post请求:
response = HTTPoison.post!(api_url,multipart_request_body, headers)
我得到的是status_code:200
,返回的元数据是%{“id”=>“0B6Xd6TBQkqUPM0s4TEY5SGRXcU0”,“kind”=>“drive#file”,
“mimeType”=>“text/csv”,“name”=>“text.csv”}
但是当我检查我的谷歌硬盘时,文件根本不存在,我无法使用returnid
获取文件
我在这里被困了好几个小时了,有谁能帮我这里出了什么问题吗?服务帐户不是你的。将服务帐户视为虚拟用户。它有自己的驱动器帐户,谷歌日历帐户,可能还有更多 当您上载到服务帐户时,您正在上载到服务帐户Google drive帐户。无法通过图形方式访问服务帐户驱动器帐户,例如Google驱动器网站 现在你有几个选择
我的服务帐户教程深入介绍了服务帐户的工作原理。您确定access\u令牌与您正在检查的Google Drive帐户属于同一帐户吗?上传后,请尝试创建一个files.list。API说它已经上传了。它会给你一个上传文件的文件id。这可能是您正在使用的服务帐户,并且您正在上载到服务帐户驱动器帐户。@DaImTo是的,我正在使用服务帐户上载文件,如何查看服务帐户驱动器帐户?