次の StackOverflow の質問は、この件に関して広く参照されているようです。
API を使用して Google ドライブにファイルを追加/作成/挿入するにはどうすればよいですか?
これらの簡単な指示は私には失敗しました。これが私がGoogleに送るものです:
POST https://www.googleapis.com/upload/drive/v2/files
Authorization: Bearer ya29.AHES6ZRO8SLGjreb1DbNju62WF-AHES6ZRO8SLGjreb1DbNju62
Content-Length: 347
Content-Type: multipart/mixed; boundary="1366986113131560"
--1366986113131560
Content-Type: application/json
{"mimeType":"text/plain","title":"hi.txt","parents":[{"id":"0BxnfVWt9egI_VDJnbFBpZDExTmM"}]}
--1366986113131560
Content-Type: text/plain
setPendingSave
loadSegments
setSequence
addSegment
setspanformat
setspanformat
hidespanformat
setspanformat
setspanformat
hidespanformat
--1366986113131560--
これを送信すると、Google から次のエラー メッセージが返されます。
マルチパート コンテンツに非メディア パーツが多すぎる
この点について詳しく説明したくはありませんが、API が Google ライブラリに依存しなくても機能することを実証できれば幸いです。