更新指定的資料來源。dataStreamId
、dataType
、type
、dataStreamName
和 device
屬性 (version
除外) 無法修改。
資料來源由其dataStreamId
識別。立即試用。
要求
HTTP 要求
PUT https://www.googleapis.com/fitness/v1/users/userId/dataSources/dataSourceId
參數
參數名稱 | 值 | 說明 |
---|---|---|
路徑參數 | ||
dataSourceId |
string |
要更新的資料來源的資料串流 ID。 |
userId |
string |
更新已識別對象的資料來源。使用 me 表示已驗證的使用者。目前僅支援 me 。 |
授權
這項要求至少需要取得下列其中一個範圍的授權:
內容範圍 |
---|
https://www.googleapis.com/auth/fitness.activity.write |
https://www.googleapis.com/auth/fitness.location.write |
https://www.googleapis.com/auth/fitness.body.write |
https://www.googleapis.com/auth/fitness.nutrition.write |
https://www.googleapis.com/auth/fitness.blood_pressure.write |
https://www.googleapis.com/auth/fitness.blood_glucose.write |
https://www.googleapis.com/auth/fitness.oxygen_saturation.write |
https://www.googleapis.com/auth/fitness.body_temperature.write |
https://www.googleapis.com/auth/fitness.reproductive_health.write |
詳情請參閱「驗證和授權」網頁。
要求主體
在要求內文中,提供 Users.dataSources 資源並附上以下屬性:
資源名稱 | 值 | 說明 | 附註 |
---|---|---|---|
必要屬性 | |||
application |
nested object |
將感應器資料提供給平台的應用程式相關資訊。 | |
application.name |
string |
這個應用程式的名稱。此為 REST 用戶端的必要欄位,不過我們不會強制規定此名稱是否重複。方便其他開發人員找出哪個 REST 建立了應用程式或資料來源,方便他們查看上述資料。 | |
dataStreamId |
string |
這個資料來源產生的資料串流專屬 ID。這組 ID 包括:
Android 應用程式建立的資料串流 ID 正確格式如下:type:dataType.name type:dataType.name 最後,如果由未建立資料來源的任何 REST 或 Android 用戶端讀取,開發人員專案編號和裝置 UID 就會經過模糊處理。只有資料來源建立者可以查看開發人員專案編號,而且格式是一般的。也就是說,用戶端會看到不同的 data_stream_ids 組合,與具有不同憑證的其他用戶端不同。 |
|
dataType |
nested object |
資料類型會定義健身 API 所收集、插入或查詢資料串流的結構定義。 | |
dataType.field[] |
list |
欄位代表一種資料類型的一個維度。 | |
dataType.field[].format |
string |
資料類型中各欄位支援的格式。 可接受的值如下:
|
|
dataType.field[].name |
string |
定義資料的名稱和格式。與資料類型名稱不同的是,欄位名稱並非命名空間,而且只需要在資料類型中不得重複。 | |
dataType.name |
string |
每個資料類型都有不重複的命名空間和名稱。com.google 命名空間中的所有資料類型都會與平台共用。 | |
device |
nested object |
呈現可保存感應器的整合式裝置 (例如手機或穿戴式裝置)。 | |
device.manufacturer |
string |
產品/硬體的製造商。 | |
device.model |
string |
使用者可在裝置上看見的型號名稱。 | |
device.type |
string |
代表裝置類型的常數。 可接受的值如下:
|
|
device.uid |
string |
硬體的序號或其他專屬 ID。在未建立資料來源的任何 REST 或 Android 用戶端讀取時,這個欄位會經過模糊處理。只有資料來源建立者會看到以一般格式清楚顯示的 uid 欄位。 模糊化會維持相等性,也就是說,如果 id1 == id2,如果 id1 == id2,則 obfuscated(id1) == obfuscated(id2)。 |
|
device.version |
string |
裝置硬體/軟體的版本字串。 | |
type |
string |
說明這個資料來源類型的常數。指出這個資料來源會產生原始或衍生資料。 可接受的值如下:
|
回覆
如果成功的話,這個方法會在回應主體中傳回 Users.dataSources 資源。
試試看!
使用下方的 APIs Explorer,針對有效資料呼叫這個方法,然後查看回應。