0

I have uploaded images to Firebase Storage and now i want to retrieve the list of all locations URL(Images storage location)?

Is there any API provided by Firebase or google, where we can fetch the list of data and their metadata information like location URL, image name from bucket?

Chetan Ansel
  • 398
  • 2
  • 20
  • After upload retrive url of image and store it inside `Realtime` database and access from there. – Yupi Sep 25 '18 at 10:56
  • I don't want to store images data in Realtime database, as i have more than 500 images in the storage. – Chetan Ansel Sep 25 '18 at 10:58
  • You will store just `urls` (which are type of `string` basically occupying few kb per save) of images from `Storage` inside `Realtime` database. That approach is much more easier. – Yupi Sep 25 '18 at 11:02
  • But for that i have to manually copy the URL from image' metadata section and it will took loads of efforts as i have 500 images. – Chetan Ansel Sep 25 '18 at 11:10
  • 1
    There is no API in the Firebase SDK for listing the files in a bucket or folder. See https://stackoverflow.com/questions/37335102/how-to-get-a-list-of-all-files-in-cloud-storage-in-a-firebase-app. In Cloud Functions you can use the Node.js SDK for Cloud Storage to get such a list though. – Frank van Puffelen Sep 25 '18 at 13:42
  • Thanks, Can you check my answer, if its a right way then please accept the answer. – Chetan Ansel Sep 25 '18 at 14:12

1 Answers1

1

I have check the google cloud docs, where they provide the Rest API : url -X GET -H "Authorization: Bearer [OAUTH2_TOKEN]" \ "https://www.googleapis.com/storage/v1/b/[BUCKET_NAME]/o"

By which we can retrieve the list of objects and their metadata store in bucket.

For more information, follow below link:

https://cloud.google.com/storage/docs/listing-objects#storage-list-objects-java

Chetan Ansel
  • 398
  • 2
  • 20