The following StackOverflow question seems to be widely referenced on this subject.
How do I add/create/insert files to Google Drive through the API?
These simple directions failed for me. Here's what I send 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--
When I submit this, Google responds with the error message:
Multipart content has too many non-media parts
I don't want belabor this point, but it would be nice to demonstrate that the API works without having to rely on Google libraries.