更新指定的資料來源。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 REST 用戶端建立的資料串流 ID 格式如下:type:dataType.name 如果沒有可構成資料串流 ID 的任一選用欄位,資料串流 ID 將會省略。最低的可行資料串流 ID 為:type:dataType.name:developer 專案編號 最後,只要任何未建立資料來源的 REST 或 Android 用戶端讀取,開發人員專案編號和裝置 UID 都會經過模糊處理。只有資料來源建立者才能看到開發人員專案編號,且清楚明瞭。也就是說,用戶端的 data_stream_ids 會與其他用戶端不同。 |
|
dataType |
nested object |
資料類型定義了從 Fitness 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) == obfuscated(id2)。 |
|
device.version |
string |
裝置硬體/軟體的版本字串。 | |
type |
string |
說明這個資料來源類型的常數。指出這個資料來源是否產生原始或衍生資料。 可接受的值如下:
|
回應
如果成功,此方法會在回應主體中傳回 Users.dataSources 資源。
試試看!
使用 APIs Explorer 針對即時資料呼叫這個方法,並查看回應。