更新資料集

如要更新資料集的相關資訊,請將 HTTP PATCH 要求傳送至 修補資料集端點 也包含資料集的 ID:

https://mapsplatformdatasets.googleapis.com/v1/projects/PROJECT_NUMBER_OR_ID/datasets/DATASET_ID

您可以更新 displayNamedescription 屬性,也可以同時更新兩者 資料集

例如:

curl -X PATCH -d '{
    "displayName": "My Updated Dataset",
    "description": "This is an updated description"
  }' \
  -H 'X-Goog-User-Project: PROJECT_NUMBER_OR_ID' \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $TOKEN" \
  https://mapsplatformdatasets.googleapis.com/v1/projects/PROJECT_NUMBER_OR_ID/datasets/f57074a0-a8b6-403e-9df1-e8a9e4f9fc46

這項要求會傳回更新資料集的相關資訊:

{
  "name": "projects/PROJECT_NUMBER_OR_ID/datasets/f57074a0-a8b6-403e-9df1-e8a9e4f9fc46",
  "displayName": "My Updated Dataset",
  "description": "This is an updated description",
  "versionId": "5fb3b84e-1405-4ecd-8f81-9183631f1c07",
  "usage": [
    "USAGE_DATA_DRIVEN_STYLING"
  ],
  "gcsSource": {
    "inputUri": "gs://mybucket/my.csv",
    "fileFormat": "FILE_FORMAT_CSV"
  },
  "createTime": "2023-03-24T14:47:37.308977Z",
  "updateTime": "2023-03-28T15:17:17.919351Z",
  "versionCreateTime": "2023-03-24T14:48:05.053114Z",
  "status": {
    "state": "STATE_COMPLETED"
  }
}

指定欄位遮罩

根據預設,更新會修改主體中指定的所有支援欄位 範圍,即 displayNamedescription。不過, 此參數也包含 updateMask敬上 要求中明確指定 要求主體進行更新

使用 updateMask 來指定以半形逗號分隔的完整名稱清單 要更新的欄位。例如,如果只要更新 displayName 欄位:

curl -X PATCH -d '{
    "displayName": "My Updated Dataset",
    "description": "This is an updated description"
  }' \
  -H 'X-Goog-User-Project: PROJECT_NUMBER_OR_ID' \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $TOKEN" \
  https://mapsplatformdatasets.googleapis.com/v1/projects/PROJECT_NUMBER_OR_ID/datasets/f57074a0-a8b6-403e-9df1-e8a9e4f9fc46?updateMask=displayName

updateMask 查詢參數的預設值為 *。 更新要求主體中指定的所有支援欄位。