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 のサンプルをご覧ください。