Google Storage API - Retrieve object with "/" in name -
when try retrieve object "/" in name of file information , metadata in response, link file points "not found". applies both in code, , using api explorer on website.
for example, file named "testfolder/test.txt". shows in developer console correctly pseudo-folder named "testfolder/" , file inside named "test.txt", when on "testfolder/test.txt", or list prefix of "testfolder/" run issue mentioned above.
i can retrieve object file fine in gsutil , console. can retrieve object file fine api if use symbol other "/". it's "/" causing link api response not point file correctly.
request:
get https://www.googleapis.com/storage/v1/b/dschaffertestbucket/o/testfolder%2ftest.txt?key={your_api_key}
response:
200 ok { "kind": "storage#object", "id": "dschaffertestbucket/testfolder/test.txt/1429992872601000", "selflink": "https://www.googleapis.com/storage/v1/b/dschaffertestbucket/o/testfolder%2ftest.txt", "name": "testfolder/test.txt", "bucket": "dschaffertestbucket", "generation": "1429992872601000", "metageneration": "1", "contenttype": "application/octet-stream", "updated": "2015-04-25t20:14:32.600z", "storageclass": "standard", "size": "14", "md5hash": "vlrq6jkgmdfykjkkn1ebfq==", "medialink": "https://www.googleapis.com/download/storage/v1/b/dschaffertestbucket/o/testfolder%2ftest.txt?generation=1429992872601000&alt=media", "owner": { "entity": "user-00b4903a971fb6d48e9e442442b7892dfc55f81ce026106122cb58989d926f00", "entityid": "00b4903a971fb6d48e9e442442b7892dfc55f81ce026106122cb58989d926f00" }, "crc32c": "qcfj8q==", "etag": "ckjlz8miksuceae=" }
in article can find cloud storage doesn't have file hierarchy windows , linux, , 'gsutil' , cloud storage apis give illusion of one.
in case easier avoid including "/" character in file names, or use different character instead.
Comments
Post a Comment