google-api-go-client: drive/v2: resumable uploads

243 views
Skip to first unread message

Nick Craig-Wood

unread,
Feb 23, 2015, 3:47:00 PM2/23/15
to golang-nuts
I was trying to use the resumable upload feature in the drive/v2 api

http://godoc.org/github.com/google/google-api-go-client/drive/v2#FilesInsertCall.ResumableMedia

However I get this error when I call Do()

Put error Upload failed: resumable uploads must set the Name parameter.

Tracing the code through, this comes from here

https://github.com/google/google-api-go-client/blob/master/drive/v2/drive-gen.go#L3822

However nowhere in the drive/v2 API is there a Name parameter, so I'm
not sure what is required!

Any help appreciated

Thanks

Nick

PS The issues seem to still be at
http://code.google.com/p/google-api-go-client/issues/list not at
https://github.com/google/google-api-go-client

--
Nick Craig-Wood <ni...@craig-wood.com> -- http://www.craig-wood.com/nick

Glenn Lewis

unread,
Feb 24, 2015, 12:34:53 PM2/24/15
to golan...@googlegroups.com
Hi Nick,

The resumable uploads feature is a work-in progress and is likely to dramatically change, so I don't recommend using it yet.
It was written initially to support the storage:v1 API (and the Google Cloud Storage client library veneer) which requires the "Name" parameter on uploads.

If, however, you want to try it out locally with drive:v2, then you could comment out that check for the name parameter and see how it goes.

I apologize for the inconvenience.
-- Glenn

Nick Craig-Wood

unread,
Feb 25, 2015, 8:39:37 AM2/25/15
to Glenn Lewis, golan...@googlegroups.com
On 24/02/15 17:34, Glenn Lewis wrote:
> The resumable uploads feature is a work-in progress and is likely to
> dramatically change, so I don't recommend using it yet.
> It was written initially to support the storage:v1 API (and the Google
> Cloud Storage client library veneer) which requires the "Name" parameter
> on uploads.

Ah OK.

I'll probably end up re-implementing it as it doesn't have exactly the
interface I want - I don't have an io.ReadSeeker, only an io.Reader.

I made an adaptor from io.Reader to io.ReadSeeker which allowed limited
seeking, but I think I'd be better off re-implementing the resumable
upload stuff to work with a limited buffer size, especially since it
isn't ready for prime time yet.

> If, however, you want to try it out locally with drive:v2, then you
> could comment out that check for the name parameter and see how it goes.

I'll try that just for interests sake!

Thanks

Nick

nher...@google.com

unread,
Feb 29, 2016, 5:07:26 PM2/29/16
to golang-nuts, gml...@google.com
FWIW, the name parameter isn't even required for Storage uploads. You just need to provide a name, which you can do either via parameter or by providing the name in the JSON metadata body. :/
Reply all
Reply to author
Forward
0 new messages