更新資料集
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
如要更新資料集資訊,請將 HTTP PATCH
要求傳送至 patch dataset 端點,並一併提供資料集 ID:
https://mapsplatformdatasets.googleapis.com/v1/projects/PROJECT_NUMBER_OR_ID/datasets/DATASET_ID
您可以更新資料集的 displayName
和/或 description
屬性。
例如:
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"
}
}
指定欄位遮罩
根據預設,更新會修改要求主體中指定的所有支援欄位,也就是 displayName
和 description
。不過,您也可以在要求中加入 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
查詢參數的預設值為 *
,表示更新要求主體中指定的所有支援欄位。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-31 (世界標準時間)。
[null,null,["上次更新時間:2025-08-31 (世界標準時間)。"],[[["\u003cp\u003eUpdate dataset metadata, such as \u003ccode\u003edisplayName\u003c/code\u003e and \u003ccode\u003edescription\u003c/code\u003e, using an HTTP \u003ccode\u003ePATCH\u003c/code\u003e request to the specified endpoint with the dataset ID.\u003c/p\u003e\n"],["\u003cp\u003eTo update the actual data within the dataset, a separate procedure outlined in the "Upload new data to the dataset" documentation should be followed.\u003c/p\u003e\n"],["\u003cp\u003eBy default, a \u003ccode\u003ePATCH\u003c/code\u003e request updates all provided fields (\u003ccode\u003edisplayName\u003c/code\u003e, \u003ccode\u003edescription\u003c/code\u003e), but you can selectively update fields using the \u003ccode\u003eupdateMask\u003c/code\u003e query parameter.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eupdateMask\u003c/code\u003e parameter accepts a comma-separated list of field names, allowing for granular control over which dataset attributes are modified.\u003c/p\u003e\n"]]],["To update dataset information, send a `PATCH` request to the specified endpoint, including the dataset ID. Modify the `displayName` and/or `description` properties in the request body. To control which fields are updated, utilize the `updateMask` query parameter with a comma-separated list of field names. Without `updateMask`, both fields are updated if present. The request returns details of the modified dataset. Note that updating data within the dataset uses a separate process.\n"],null,["# Update a dataset\n\nUpdate information about a dataset by sending an HTTP `PATCH` request to the\n[patch dataset](/maps/documentation/datasets/reference/rest/v1/projects.datasets/patch) endpoint that\nalso includes the ID of the dataset: \n\n```html\nhttps://mapsplatformdatasets.googleapis.com/v1/projects/PROJECT_NUMBER_OR_ID/datasets/DATASET_ID\n```\n\nYou can update either or both of the `displayName` and `description` properties\nof the dataset.\n| **Note:** To update the data for the dataset, use the procedure described in [Upload new data to the dataset](/maps/documentation/datasets/create#new-version).\n\nFor example: \n\n```\ncurl -X PATCH -d '{\n \"displayName\": \"My Updated Dataset\",\n \"description\": \"This is an updated description\"\n }' \\\n -H 'X-Goog-User-Project: PROJECT_NUMBER_OR_ID' \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $TOKEN\" \\\n \"https://mapsplatformdatasets.googleapis.com/v1/projects/PROJECT_NUMBER_OR_ID/datasets/f57074a0-a8b6-403e-9df1-e8a9e4f9fc46\"\n```\n\nThe request returns information about the updated dataset: \n\n```\n{\n \"name\": \"projects/PROJECT_NUMBER_OR_ID/datasets/f57074a0-a8b6-403e-9df1-e8a9e4f9fc46\",\n \"displayName\": \"My Updated Dataset\",\n \"description\": \"This is an updated description\",\n \"versionId\": \"5fb3b84e-1405-4ecd-8f81-9183631f1c07\",\n \"usage\": [\n \"USAGE_DATA_DRIVEN_STYLING\"\n ],\n \"gcsSource\": {\n \"inputUri\": \"gs://mybucket/my.csv\",\n \"fileFormat\": \"FILE_FORMAT_CSV\"\n },\n \"createTime\": \"2023-03-24T14:47:37.308977Z\",\n \"updateTime\": \"2023-03-28T15:17:17.919351Z\",\n \"versionCreateTime\": \"2023-03-24T14:48:05.053114Z\",\n \"status\": {\n \"state\": \"STATE_COMPLETED\"\n }\n}\n```\n\nSpecify a field mask\n--------------------\n\nBy default, the update modifies all the supported fields specified in the body\nof the request, meaning both `displayName` and `description`. However, you can\nalso include the\n[`updateMask`](/maps/documentation/datasets/reference/rest/v1/projects.datasets/patch#query-parameters)\nquery parameter in the request to explicitly specify the fields in the\nrequest body to update.\n\nUse `updateMask` to specify a comma-separated list of fully qualified names of\nfields to update. For example, to update only the `displayName` field: \n\n```\ncurl -X PATCH -d '{\n \"displayName\": \"My Updated Dataset\",\n \"description\": \"This is an updated description\"\n }' \\\n -H 'X-Goog-User-Project: PROJECT_NUMBER_OR_ID' \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $TOKEN\" \\\n \"https://mapsplatformdatasets.googleapis.com/v1/projects/PROJECT_NUMBER_OR_ID/datasets/f57074a0-a8b6-403e-9df1-e8a9e4f9fc46?updateMask=displayName\"\n```\n\nThe default value of the `updateMask` query parameter is `*` meaning\nupdate all supported fields specified in the request body."]]