First, create a file named something like "multipart.txt" that contains your multipart message. The first line must be the boundary (with -- in front), and the last line must be the boundary with a -- in front and a -- at the end:
--myboundary Content-Type: application/json; charset=UTF-8 { "name": "myObject.txt", "contentType": "text/plain" } --myboundary Content-Type: text/plain This is some text data type. --myboundary--
Okay, now upload that sucker with curl:
$> curl -X POST -T multipart.txt -H 'Content-Type: multipart/related; boundary=myboundary' 'https://www.googleapis.com/upload/storage/v1/b/bucket_name/o?uploadType=multipart'
Note that we used -T (--upload-file) instead of --data. --data treats data like a web browser would, which is not what we want in this case. We could also have used "--data-binary @multipart.txt" for the same effect, but that's so may more characters.
Note that we used -T (--upload-file) instead of --data. --data treats data like a web browser would, which is not what we want in this case. We could also have used "--data-binary @multipart.txt" for the same effect, but that's so may more characters.