Patrick Jackson
Patrick Jackson

Reputation: 19446

Google Storage Json Api - access "folders" from api fails?

I am having problems accessing objects that use slashes through the api. For example I have objects with the names "folder1/folder2/name". When I use this with the api I get a 400 bad request. Is this not supported yet by the Api? or is a special character needed? This also fails for me on the API explorer.

Upvotes: 1

Views: 132

Answers (1)

Nathan Herring
Nathan Herring

Reputation: 977

This is a URL encoding issue. The object name is a single URL path part, and thus all slashes in the name need to be %-encoded. (i.e., folder1%2ffolder2%2fname)

API explorer, unfortunately, has a known issue (reported internally) with storage.objects.get. The method returns actual file data, and the API explorer is expecting JSON metadata and things go poorly from there.

Upvotes: 4

Related Questions