younifyd
Menu

Firestore.projects.databases.documents.commit

Commits a transaction, while optionally updating documents.

POST/v1/{database}/documents:commit

Use it in a workflow

  1. Add a step and choose the Firestore connector.
  2. Pick the Firestore.projects.databases.documents.commit action (under projects).
  3. Fill in the fields below, then reference the result from later steps as {{firestoreProjectsDatabasesDocumentsCommit.response.data}}.

Request

Path parameters

databasestringrequired

Required. The database name. In the format: `projects/{project_id}/databases/{database_id}`.

Query parameters

$.xgafvstring

V1 error format.

One of12

access_tokenstring

OAuth access token.

altstring

Data format for response.

One ofjsonmediaproto

callbackstring

JSONP

fieldsstring

Selector specifying which fields to include in a partial response.

keystring

API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.

oauth_tokenstring

OAuth 2.0 token for the current user.

prettyPrintboolean

Returns response with indentations and line breaks.

quotaUserstring

Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

upload_protocolstring

Upload protocol for media (e.g. "raw", "multipart").

uploadTypestring

Legacy upload protocol for media (e.g. "media", "multipart").

Request body

Enter the body as JSON in the step's Body field.

transactionstring (byte)

If set, applies all writes in this transaction, and commits it.

writesarray<object>

The writes to apply. Always executed atomically and in order.

currentDocumentobject2 fields

A precondition on a document, used for conditional operations.

deletestring

A document name to delete. In the format: `projects/{project_id}/databases/{database_id}/documents/{document_path}`.

transformobject2 fields

A transformation of a document.

updateobject4 fields

A Firestore document. Must not exceed 1 MiB - 4 bytes.

updateMaskobject1 fields

A set of field paths on a document. Used to restrict a get or update operation on a document to a subset of its fields. This is different from standard field masks, as this is always scoped to a Document, and takes in account the dynamic nature of Value.

updateTransformsarray<object>7 fields

The transforms to perform after update. This field can be set only when the operation is `update`. If present, this write is equivalent to performing `update` and `transform` to the same document atomically and in order.

json
{
  "transaction": "string",
  "writes": [
    {
      "currentDocument": {
        "exists": false,
        "updateTime": "string"
      },
      "delete": "string",
      "transform": {
        "document": "string",
        "fieldTransforms": [
          {
            "appendMissingElements": {
              "values": null
            },
            "fieldPath": "string",
            "increment": {
              "arrayValue": null,
              "booleanValue": null,
              "bytesValue": null,
              "doubleValue": null,
              "geoPointValue": null,
              "integerValue": null,
              "mapValue": null,
              "nullValue": null,
              "referenceValue": null,
              "stringValue": null,
              "timestampValue": null
            },
            "maximum": {
              "arrayValue": null,
              "booleanValue": null,
              "bytesValue": null,
              "doubleValue": null,
              "geoPointValue": null,
              "integerValue": null,
              "mapValue": null,
              "nullValue": null,
              "referenceValue": null,
              "stringValue": null,
              "timestampValue": null
            },
            "minimum": {
              "arrayValue": null,
              "booleanValue": null,
              "bytesValue": null,
              "doubleValue": null,
              "geoPointValue": null,
              "integerValue": null,
              "mapValue": null,
              "nullValue": null,
              "referenceValue": null,
              "stringValue": null,
              "timestampValue": null
            },
            "removeAllFromArray": {
              "values": null
            },
            "setToServerValue": "SERVER_VALUE_UNSPECIFIED"
          }
        ]
      },
      "update": {
        "createTime": "string",
        "fields": {},
        "name": "string",
        "updateTime": "string"
      },
      "updateMask": {
        "fieldPaths": [
          "string"
        ]
      },
      "updateTransforms": [
        {
          "appendMissingElements": {
            "values": [
              null
            ]
          },
          "fieldPath": "string",
          "increment": {
            "arrayValue": {
              "values": null
            },
            "booleanValue": false,
            "bytesValue": "string",
            "doubleValue": 0,
            "geoPointValue": {
              "latitude": null,
              "longitude": null
            },
            "integerValue": "string",
            "mapValue": {
              "fields": null
            },
            "nullValue": "NULL_VALUE",
            "referenceValue": "string",
            "stringValue": "string",
            "timestampValue": "string"
          },
          "maximum": {
            "arrayValue": {
              "values": null
            },
            "booleanValue": false,
            "bytesValue": "string",
            "doubleValue": 0,
            "geoPointValue": {
              "latitude": null,
              "longitude": null
            },
            "integerValue": "string",
            "mapValue": {
              "fields": null
            },
            "nullValue": "NULL_VALUE",
            "referenceValue": "string",
            "stringValue": "string",
            "timestampValue": "string"
          },
          "minimum": {
            "arrayValue": {
              "values": null
            },
            "booleanValue": false,
            "bytesValue": "string",
            "doubleValue": 0,
            "geoPointValue": {
              "latitude": null,
              "longitude": null
            },
            "integerValue": "string",
            "mapValue": {
              "fields": null
            },
            "nullValue": "NULL_VALUE",
            "referenceValue": "string",
            "stringValue": "string",
            "timestampValue": "string"
          },
          "removeAllFromArray": {
            "values": [
              null
            ]
          },
          "setToServerValue": "SERVER_VALUE_UNSPECIFIED"
        }
      ]
    }
  ]
}

Response

Returns 200 with an object. Read it in later steps with {{firestoreProjectsDatabasesDocumentsCommit.response.data.<field>}}.

commitTimestring (google-datetime)

The time at which the commit occurred. Any read with an equal or greater `read_time` is guaranteed to see the effects of the commit.

writeResultsarray<object>

The result of applying the writes. This i-th write result corresponds to the i-th write in the request.

transformResultsarray<object>11 fields

The results of applying each DocumentTransform.FieldTransform, in the same order.

updateTimestring (google-datetime)

The last update time of the document after applying the write. Not set after a `delete`. If the write did not actually change the document, this will be the previous update_time.

json
{
  "commitTime": "string",
  "writeResults": [
    {
      "transformResults": [
        {
          "arrayValue": {
            "values": [
              null
            ]
          },
          "booleanValue": false,
          "bytesValue": "string",
          "doubleValue": 0,
          "geoPointValue": {
            "latitude": 0,
            "longitude": 0
          },
          "integerValue": "string",
          "mapValue": {
            "fields": {}
          },
          "nullValue": "NULL_VALUE",
          "referenceValue": "string",
          "stringValue": "string",
          "timestampValue": "string"
        }
      ],
      "updateTime": "string"
    }
  ]
}

Need more? See the Firestore guide for connection setup and behaviour shared by every action.