Keith Chan
Keith Chan

Reputation: 21

Adding image to question item in the new google form rest api

Is it possible to use image in the google drive? If yes, how? I have tried using https://drive.google.com/uc?id= + id, but failed.

error": { "code": 400, "message": "Failed to fetch image from source_uri: https://drive.google.com/uc?id=xxxxxxxxxxxxxxxxxxxx", "status": "INVALID_ARGUMENT" }


Image { "contentUri": string, "altText": string, "properties": { object (MediaProperties) }, "sourceUri": string }

Upvotes: 1

Views: 802

Answers (1)

Juan Fernandez
Juan Fernandez

Reputation: 1

I use this form

update = {
            "requests": [{
            {
                "createItem": {
                    "item": {
                        "imageItem": {
                            "image": {
                                "sourceUri": https://drive.google.com/uc...
                                }
                            }   
                    },
                    "location": {
                        "index": 0
                    }
                },
            },
            ]
        }

service_form.forms().batchUpdate(
      formId=form_id, body=update).execute()

Doc https://developers.google.com/forms/api/reference/rest/v1/forms/batchUpdate

Upvotes: 0

Related Questions