NITIN K SHARMA
NITIN K SHARMA

Reputation: 23

SourceImage as Google storage bucket link while inserting new image

What should be the proper format to provide Google storage image link while images.insert ? Image file located at GS Bucket as *.tar.gz. Creating new image with google client library in python with api images.insert(body=body,project=project)

my body config looks like:

body = { "name":"test", "sourceImage":"https://console.cloud.google.com/storage/browser/[BUCKET]/[IMAGEFILE]",}

Procedure fails with following error:

googleapiclient.errors.HttpError: <HttpError 400 when requesting  returned "Invalid value for field 'resource.sourceImage': 'https://storag
e.cloud.google.com/[BUCKET]/[IMAGEFILE]'. The URL is malformed.">

Upvotes: 0

Views: 345

Answers (1)

dany L
dany L

Reputation: 2654

In order to access an image from Google storage, please use “rawDisk” instead. Here is an example:

"name": "image-1",
  "rawDisk": {
    "source": "https://storage.googleapis.com/[bucket]/[imagefile]"
  }

Where [bucket] is the name of your bucket and [imagefile] = *.tar.gz

Upvotes: 1

Related Questions