curl で Cloud Firestore のデータを更新 (Update)
Cloud Firestore の RestAPI を使ってデータを更新します。
update01.json
{
"fields": {
"population": { "integerValue": "27513000" },
"date_mod": { "stringValue": "2020-06-01" }
}
}
project-aaa の cities の t0921 を更新
firestore_update.sh
#
#
#
export GOOGLE_APPLICATION_CREDENTIALS="***.json"
#
ACCESS_TOKEN=`gcloud auth application-default print-access-token`
#
project_id=`jq .project_id $GOOGLE_APPLICATION_CREDENTIALS | sed "s/\"//g"`
echo $project_id
#
URL='https://firestore.googleapis.com/v1/projects/'$project_id'/databases/(default)/documents/cities/t0921'
#
#
curl -H "Authorization: Bearer $ACCESS_TOKEN" \
-H 'Content-Type: application/json' \
-X PATCH \
-d@update01.json \
$URL"?updateMask.fieldPaths=population&updateMask.fieldPaths=date_mod"
#
#
Author And Source
この問題について(curl で Cloud Firestore のデータを更新 (Update)), 我々は、より多くの情報をここで見つけました https://qiita.com/ekzemplaro/items/82c13d2e894bc85f37df著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .