Google Forms API Connector Overview

The Workflows connector defines the built-in functions that can be used to access other Google Cloud products within a workflow.

This page provides an overview of the individual connector. There is no need to import or load connector libraries in a workflow—connectors work out of the box when used in a call step.

Google Forms API

Reads and writes Google Forms and responses. To learn more, see the Google Forms API documentation.

Google Forms connector sample

YAML

# This workflow demonstrates how to use the Google Forms connector:
# Create, update, get, and delete a Google Form
# Expected output: "SUCCESS"
- init:
    assign:
      - form_title: "sample-form"
- create_form:
    call: googleapis.forms.v1.forms.create
    args:
      body:
        info:
          title: ${form_title}
    result: create_form_resp
- update_form:
    call: googleapis.forms.v1.forms.batchUpdate
    args:
      formId: ${create_form_resp.formId}
      body:
        requests:
          - updateFormInfo:
              info:
                title: "new-title"
              updateMask: title
- get_form:
    call: googleapis.forms.v1.forms.get
    args:
      formId: ${create_form_resp.formId}
- list_responses:
    call: googleapis.forms.v1.forms.responses.list
    args:
      formId: ${create_form_resp.formId}
      pageSize: 10
- delete_form:
    call: http.delete
    args:
      url: ${"https://www.googleapis.com/drive/v3/files/" + create_form_resp.formId}
      auth:
        type: OAuth2
        scope: https://www.googleapis.com/auth/drive
- the_end:
    return: "SUCCESS"

JSON

[
  {
    "init": {
      "assign": [
        {
          "form_title": "sample-form"
        }
      ]
    }
  },
  {
    "create_form": {
      "call": "googleapis.forms.v1.forms.create",
      "args": {
        "body": {
          "info": {
            "title": "${form_title}"
          }
        }
      },
      "result": "create_form_resp"
    }
  },
  {
    "update_form": {
      "call": "googleapis.forms.v1.forms.batchUpdate",
      "args": {
        "formId": "${create_form_resp.formId}",
        "body": {
          "requests": [
            {
              "updateFormInfo": {
                "info": {
                  "title": "new-title"
                },
                "updateMask": "title"
              }
            }
          ]
        }
      }
    }
  },
  {
    "get_form": {
      "call": "googleapis.forms.v1.forms.get",
      "args": {
        "formId": "${create_form_resp.formId}"
      }
    }
  },
  {
    "list_responses": {
      "call": "googleapis.forms.v1.forms.responses.list",
      "args": {
        "formId": "${create_form_resp.formId}",
        "pageSize": 10
      }
    }
  },
  {
    "delete_form": {
      "call": "http.delete",
      "args": {
        "url": "${\"https://www.googleapis.com/drive/v3/files/\" + create_form_resp.formId}",
        "auth": {
          "type": "OAuth2",
          "scope": "https://www.googleapis.com/auth/drive"
        }
      }
    }
  },
  {
    "the_end": {
      "return": "SUCCESS"
    }
  }
]

Module: googleapis.forms.v1.forms

Functions
batchUpdate Change the form with a batch of updates.
create Create a new form using the title given in the provided form message in the request. Important: Only the form.info.title and form.info.document_title fields are copied to the new form. All other fields including the form description, items and settings are disallowed. To create a new form and add items, you must first call forms.create to create an empty form with a title and (optional) document title, and then call forms.update to add the items.
get Get a form.

Module: googleapis.forms.v1.forms.responses

Functions
get Get one response from the form.
list List a form's responses.

Module: googleapis.forms.v1.forms.watches

Functions
delete Delete a watch.
list Return a list of the watches owned by the invoking project. The maximum number of watches is two: For each invoker, the limit is one for each event type per form.
renew Renew an existing watch for seven days. The state of the watch after renewal is ACTIVE, and the expire_time is seven days from the renewal. Renewing a watch in an error state (e.g. SUSPENDED) succeeds if the error is no longer present, but fail otherwise. After a watch has expired, RenewWatch returns NOT_FOUND.