再開可能なアップロードを試みましたが、あまり成功しませんでした。
https://developers.google.com/drive/manage-uploads#resumableページを読みましたが、最初のリクエストの応答でこの「Location」ヘッダーを取得する方法がわかりません。
APIドキュメントでは、最初のURLでPOSTまたはPUTのいずれかを作成できると指定されていますが、PUTを作成すると404が取得され、POSTを作成すると、コンテンツとLocationヘッダーのない新しいファイルが作成されます。応答で。
これが私のPOSTクエリです(PUTとまったく同じクエリで404を返します):
POST https://www.googleapis.com/drive/v2/files?uploadType=resumable
Accept = application/json
Authorization = Bearer xxxxxxxxx
Content-Length = 71
Content-Type = application/json
X-Upload-Content-Length = 10
X-Upload-Content-Type = text/plain
{
mimeType = "text/plain";
parents = (
{
id = root;
}
);
title = "test.txt";
}
と応答:
"Cache-Control" = "no-cache, no-store, max-age=0, must-revalidate";
"Content-Type" = "application/json; charset=UTF-8";
Date = "Wed, 29 Aug 2012 09:53:15 GMT";
Etag = "\"UlXjrWs5BKksMni8RDMKhlFkHGQ/MTM0NjIzMzk5NTA2MQ\"";
Expires = "Fri, 01 Jan 1990 00:00:00 GMT";
Pragma = "no-cache";
Server = GSE;
"Transfer-Encoding" = Identity;
"X-Content-Type-Options" = nosniff;
"X-Frame-Options" = SAMEORIGIN;
"X-XSS-Protection" = "1; mode=block";
{
"kind": "drive#file",
"id": "xxxx",
"etag": "\"xxxx\"",
"selfLink": "https://xxxx",
"webContentLink": "https://xxxx",
"alternateLink": "https://xxxx",
"title": "test.txt",
"mimeType": "text/plain",
"labels": {
"starred": false,
"hidden": false,
"trashed": false,
"restricted": false,
"viewed": true
},
"createdDate": "2012-08-29T09:53:15.200Z",
"modifiedDate": "2012-08-29T09:53:15.061Z",
"modifiedByMeDate": "2012-08-29T09:53:15.061Z",
"lastViewedByMeDate": "2012-08-29T09:53:15.061Z",
"parents": [
{
"kind": "drive#parentReference",
"id": "xxxx",
"selfLink": "https://xxxx",
"parentLink": "https://xxxx",
"isRoot": true
}
],
"downloadUrl": "https://xxxx",
"userPermission": {
"kind": "drive#permission",
"etag": "\"xxxx\"",
"id": "me",
"selfLink": "https://xxxx",
"role": "owner",
"type": "user"
},
"originalFilename": "test.txt",
"fileExtension": "txt",
"md5Checksum": "xxxx",
"fileSize": "0",
"quotaBytesUsed": "0",
"ownerNames": [
"xxxx"
],
"lastModifyingUserName": "xxxx",
"editable": true,
"writersCanShare": true
}