通过 HTTP 请求将数据写入 Firestore

在工作流中发出经过身份验证的请求,并使用 OAuth 2.0 将数据写入 Firestore。

代码示例

YAML

- initialize:
    assign:
    - project: "myproject123"
    - collection: "myEntries"
    - document: "Visits"
- write_item:
    call: http.request
    args:
      url: ${"https://firestore.googleapis.com/v1/projects/"+project+"/databases/(default)/documents/"+collection+"/"+document}
      auth:
        type: OAuth2
      method: PATCH
      body:
        name: ${"projects/"+project+"/databases/(default)/documents/"+collection+"/"+document}
        fields:
          Counter:
            integerValue: 7

后续步骤

如需搜索和过滤其他 Google Cloud 产品的代码示例,请参阅 Google Cloud 示例浏览器