ドライブv3にイメージファイルを作成していますが、ファイルのURIを取得できません。私は成功のresponse_objectでそれを見つけることを期待しています。node.js/google drive sdk v3:webContentLink(およびすべての画像メタデータ)へのアクセス
私はresponse_objectにファイルIDを見つけないと私は、画像を表示するURIを構築するためにそれを使用することができます
https://drive.google.com/file/d/0Bw4DMtLCtPMkNERiTnpVNDdQV2c/view
私が手に「正しい/公式」URIを持っていると思います画像ソースとしてgoogle Cloud Vision APIに送信します。私はwebContentLinkのv3ファイルのメタデータを探していると思います。もっと一般的には、私が作成したばかりのファイルのすべてのメタデータを(https://developers.google.com/drive/v3/reference/filesに記載されているように)取得する方法がわかりません。
var newFileMetadata = {
'name': unique_file_name,
description: options.multipart,
useContentAsIndexableText: false,
parents: [ file.id ]
};
var media = {
mimeType: 'image/jpg',
body: fs.createReadStream(options.src_dir + '/' + sourceFile),
viewersCanCopyContent: true,
writersCanShare: true
};
var request_object = drive.files.create({
auth: auth,
resource: newFileMetadata,
media: media,
fields: ['id']
},
function(err, response) {
if (err) {
console.log('drive.files.create error: %s %s', err, response);
return;
} else {
// file create success; get response
console.log('dump the response\n %s', JSON.stringify(response));
}
}
); // end of drive.files.create()
とコンソール出力(読みやすくするためにCR)である: { "プロトコル": "HTTPS:"、 "スラッシュ"
request_objectを
{ "URI" をダンプ:true、 "auth":null、 "host": "www.googleapis.com"、 "port":null、 "hostname": "www.googleapis.com"、 "hash":null、 "search": "?fields = id & uploadType "/ upload/drive/v3/files"、 "path": "/ upload/drive/v3/files?"と入力してください。フィールドID = & uploadType =マルチ " "HREF":" https://www.googleapis.com/upload/drive/v3/files?fields=id&uploadType=multipart "}、 "方法":" POST」、 "ヘッダ":{ "許可": "ベアラya29.GlxfB18oVtG6A3j7cXzSq17-RSmj9-2BlQm4zHD5sPzKkfhRM1FxlxUHc9mxWaka1N2fBiTJun-SYLB8ewuc63XVbUo01q0bS2FiS6iJTq9O1h9FQWfoO5r8E6z_6Q" 、 "User-Agent": "google-api-nodejs-client/0.10.0"、 "host": "www.googleapis.com"、 "transfer-encoding": "chunked"、 "content-type ":" multipart/related; 境界= d6cef3f5-2246-5654-ac1f-d00561be5e8a "}}
応答 {ダンプ" のIDを ":" 0Bw4DMtLCtPMkNERiTnpVNDdQV2c "}
要約へ:
- 私はどのように入手できますか(Node.js内)新しく作成されたgoogleドライブv3画像ファイルのGoogle Cloud Visionの適切なURI?
- 新しく作成されたGoogleドライブv3画像ファイルのメタデータはどのように取得されますか?
多くのありがとうございます。
新しい情報:私は別のdrive.files.getを試してみました()
drive.files.get({
auth: auth,
fileId: response.id
},
function(err, response) {
if (err) {
console.log('drive.files.get error: %s %s', err, response);
return;
} else {
// file create success; get properties
console.log('get properties\n %s', JSON.stringify(response));
}
});
と私はいくつかのメタデータ(ただし、大きな絵)、コンソール出力、新しいアップロード受信の操作を行います。
をプロパティを取得する {"kind": "ドライブ#ファイル"、 "id": "0Bw4DMtLCtPMkWFdTMUVwY2tRZ2c"、 "name": "2017-06-04T17:57:42.189Zlovelock。PNG」、 『MIMEタイプ』: 『。。画像/ PNG』}