- HTTP request
- Path parameters
- Request body
- Response body
- Authorization scopes
- Request
- UpdateFormInfoRequest
- UpdateSettingsRequest
- CreateItemRequest
- Location
- MoveItemRequest
- DeleteItemRequest
- UpdateItemRequest
- WriteControl
- Response
- CreateItemResponse
- Try it!
Change the form with a batch of updates.
HTTP request
POST https://forms.googleapis.com/v1/forms/{formId}:batchUpdate
The URL uses gRPC Transcoding syntax.
Path parameters
Parameters | |
---|---|
formId |
Required. The form ID. |
Request body
The request body contains data with the following structure:
JSON representation |
---|
{ "includeFormInResponse": boolean, "requests": [ { object ( |
Fields | |
---|---|
includeFormInResponse |
Whether to return an updated version of the model in the response. |
requests[] |
Required. The update requests of this batch. |
writeControl |
Provides control over how write requests are executed. |
Response body
Response to a BatchUpdateFormRequest.
If successful, the response body contains data with the following structure:
JSON representation |
---|
{ "form": { object ( |
Fields | |
---|---|
form |
Based on the bool request field |
replies[] |
The reply of the updates. This maps 1:1 with the update requests, although replies to some requests may be empty. |
writeControl |
The updated write control after applying the request. |
Authorization scopes
Requires one of the following OAuth scopes:
https://www.googleapis.com/auth/drive
https://www.googleapis.com/auth/drive.file
https://www.googleapis.com/auth/forms.body
For more information, see the Authorization guide.
Request
The kinds of update requests that can be made.
JSON representation |
---|
{ // Union field |
Fields | |
---|---|
Union field kind . The kind of request. kind can be only one of the following: |
|
updateFormInfo |
Update Form's Info. |
updateSettings |
Updates the Form's settings. |
createItem |
Create a new item. |
moveItem |
Move an item to a specified location. |
deleteItem |
Delete an item. |
updateItem |
Update an item. |
UpdateFormInfoRequest
Update Form's Info.
JSON representation |
---|
{
"info": {
object ( |
Fields | |
---|---|
info |
The info to update. |
updateMask |
Required. Only values named in this mask are changed. At least one field must be specified. The root This is a comma-separated list of fully qualified names of fields. Example: |
UpdateSettingsRequest
Update Form's FormSettings
.
JSON representation |
---|
{
"settings": {
object ( |
Fields | |
---|---|
settings |
Required. The settings to update with. |
updateMask |
Required. Only values named in this mask are changed. At least one field must be specified. The root This is a comma-separated list of fully qualified names of fields. Example: |
CreateItemRequest
Create an item in a form.
JSON representation |
---|
{ "item": { object ( |
Fields | |
---|---|
item |
Required. The item to create. |
location |
Required. Where to place the new item. |
Location
A specific location in a form.
JSON representation |
---|
{ // Union field |
Fields | |
---|---|
Union field where . Required. Specify a location in the form. where can be only one of the following: |
|
index |
The index of an item in the form. This must be in the range
, where N is the number of items in the form. |
MoveItemRequest
Move an item in a form.
JSON representation |
---|
{ "originalLocation": { object ( |
Fields | |
---|---|
originalLocation |
Required. The location of the item to move. |
newLocation |
Required. The new location for the item. |
DeleteItemRequest
Delete an item in a form.
JSON representation |
---|
{
"location": {
object ( |
Fields | |
---|---|
location |
Required. The location of the item to delete. |
UpdateItemRequest
Update an item in a form.
JSON representation |
---|
{ "item": { object ( |
Fields | |
---|---|
item |
Required. New values for the item. Note that item and question IDs are used if they are provided (and are in the field mask). If an ID is blank (and in the field mask) a new ID is generated. This means you can modify an item by getting the form via |
location |
Required. The location identifying the item to update. |
updateMask |
Required. Only values named in this mask are changed. This is a comma-separated list of fully qualified names of fields. Example: |
WriteControl
Provides control over how write requests are executed.
JSON representation |
---|
{ // Union field |
Fields | |
---|---|
Union field control . Determines the revision of the form from which changes are to be applied, and how the request should behave if that revision is not the current revision of the form. control can be only one of the following: |
|
requiredRevisionId |
The revision ID of the form that the write request is applied to. If this is not the latest revision of the form, the request is not processed and returns a 400 bad request error. |
targetRevisionId |
The target revision ID of the form that the write request is applied to. If changes have occurred after this revision, the changes in this update request are transformed against those changes. This results in a new revision of the form that incorporates both the changes in the request and the intervening changes, with the server resolving conflicting changes. The target revision ID may only be used to write to recent versions of a form. If the target revision is too far behind the latest revision, the request is not processed and returns a 400 (Bad Request Error). The request may be retried after reading the latest version of the form. In most cases a target revision ID remains valid for several minutes after it is read, but for frequently-edited forms this window may be shorter. |
Response
A single response from an update.
JSON representation |
---|
{ // Union field |
Fields | |
---|---|
Union field kind . The kind of response. kind can be only one of the following: |
|
createItem |
The result of creating an item. |
CreateItemResponse
The result of creating an item.
JSON representation |
---|
{ "itemId": string, "questionId": [ string ] } |
Fields | |
---|---|
itemId |
The ID of the created item. |
questionId[] |
The ID of the question created as part of this item, for a question group it lists IDs of all the questions created for this item. |