user2625247
user2625247

Reputation: 391

GoogleDrive REST API multipart upload. 400: Bad content type. Please use multipart

I'm trying to upload a file to GoogleDrive using the REST API as written here as a multipart upload with POST request: https://developers.google.com/drive/api/v3/multipart-upload.

Trying with the Advanced REST client like the example in the documentation. But with Content-Type "multipart/related" I got an Error:

400: Bad content type.  Please use multipart.

When using only "multipart" as Content-Type I got:

Media type 'multipart' is not supported. Valid media types: [*/*]

Still tried all subtypes of multipart (e. g. multipart/mixed, ...) but always got error 400.

Similar error is mentioned here: error: Bad content type. Please use multipart, but not with "multipart/related" as written in the documentation.

Any idea how to fix the issue?

Thank you and best!

Upvotes: 2

Views: 633

Answers (1)

user2625247
user2625247

Reputation: 391

After a lot of trial and error I found the issue: I had boundary as a single header parameter, but should be added to Content-Type like multipart/related; boundary=boundary53170215682661314146. Now it works correct!

Upvotes: 2

Related Questions