Users.dataSources.datasets: patch
Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Dodaje punkty danych do zbioru danych. Nie trzeba wcześniej utworzyć tego zbioru danych.
Wszystkie punkty w danym zbiorze danych zostaną zwrócone z kolejnymi wywołaniami
aby pobrać ten zbiór danych. Punkty danych mogą należeć do więcej niż 1 zbioru danych.
Ta metoda nie używa semantyki poprawki: podane punkty danych są
po prostu wstawione – istniejące dane nie są zastąpione.
Wypróbuj
Żądanie
Żądanie HTTP
PATCH https://www.googleapis.com/fitness/v1/users/userId/dataSources/dataSourceId/datasets/datasetId
Parametry
Nazwa parametru |
Wartość |
Opis |
Parametry ścieżki |
dataSourceId |
string |
Identyfikator strumienia danych źródła danych, które utworzyło zbiór danych.
|
datasetId |
string |
To pole nie jest używane i można je bezpiecznie pominąć.
|
userId |
string |
Zainstalowanie poprawki zbioru danych dla zidentyfikowanej osoby. Użyj me , aby wskazać,
uwierzytelnionego użytkownika. Obecnie obsługiwana jest tylko forma me .
|
Autoryzacja
To żądanie wymaga autoryzacji z co najmniej jednym z tych zakresów:
Zakres |
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 |
Więcej informacji znajdziesz na stronie dotyczącej uwierzytelniania i autoryzacji.
Treść żądania
W treści żądania podaj odpowiednie części zasobu Users.dataSources.datasets zgodnie z regułami semantyki poprawki z tymi właściwościami:
Nazwa usługi |
Wartość |
Opis |
Uwagi |
Właściwości wymagane |
dataSourceId |
string |
Identyfikator strumienia danych źródła danych, które utworzyło punkty w tym zbiorze danych. |
|
maxEndTimeNs |
long |
Największy czas zakończenia ze wszystkich punktów danych w tej prawdopodobnie częściowej reprezentacji zbioru danych. Czas jest podany w nanosekundach od epoki. Powinien też być zgodny z drugą częścią identyfikatora zbioru danych. |
|
minStartTimeNs |
long |
Najkrótszy czas rozpoczęcia ze wszystkich punktów danych w tej prawdopodobnie częściowej reprezentacji zbioru danych. Czas jest podany w nanosekundach od epoki. Powinien też być zgodny z pierwszą częścią identyfikatora zbioru danych. |
|
point[] |
list |
Częściowa lista punktów danych zawartych w zbiorze danych uporządkowana według parametru endTimeNanos. Podczas pobierania małego zbioru danych ta lista jest uznawana za kompletną, a podczas tworzenia poprawek do zbioru danych lub pobierania zbioru danych, który jest zbyt duży, aby go uwzględnić w pojedynczej odpowiedzi. |
|
point[].dataTypeName |
string |
Typ danych określający format wartości w tym punkcie danych. |
|
point[].endTimeNanos |
long |
Czas zakończenia przedziału reprezentowanego przez ten punkt danych w nanosekundach od początku epoki. |
|
point[].startTimeNanos |
long |
Czas rozpoczęcia przedziału reprezentowanego przez ten punkt danych w nanosekundach od początku epoki. |
|
point[].value[] |
list |
Wartości poszczególnych pól typu danych dla punktu danych. Oczekuje się, że każda wartość odpowiadająca polu typu danych będzie występować w tej samej kolejności, w jakiej pole występuje w typie danych określonym w źródle danych.
W zależności od formatu wartości wyliczeniowej w polu typu źródła danych zostanie wypełnione tylko jedno z pól liczb całkowitych i zmiennoprzecinkowych.
|
|
Wypróbuj
Użyj poniższego eksploratora interfejsów API, aby wywołać tę metodę na bieżących danych i wyświetlić odpowiedź.
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-07-25 UTC.
[null,null,["Ostatnia aktualizacja: 2025-07-25 UTC."],[[["\u003cp\u003eAdds data points to a new or existing dataset within Google Fit, returning all dataset points upon retrieval.\u003c/p\u003e\n"],["\u003cp\u003eUtilizes an insert-only approach, without replacing pre-existing data.\u003c/p\u003e\n"],["\u003cp\u003eRequires authorization with specific scopes, such as \u003ccode\u003ehttps://www.googleapis.com/auth/fitness.activity.write\u003c/code\u003e, for data access.\u003c/p\u003e\n"],["\u003cp\u003eThe request body necessitates properties like \u003ccode\u003edataSourceId\u003c/code\u003e, \u003ccode\u003emaxEndTimeNs\u003c/code\u003e, \u003ccode\u003eminStartTimeNs\u003c/code\u003e, and an array of data points (\u003ccode\u003epoint[]\u003c/code\u003e) with corresponding values.\u003c/p\u003e\n"],["\u003cp\u003eSuccessful requests return a \u003ccode\u003eUsers.dataSources.datasets\u003c/code\u003e resource containing the updated dataset information.\u003c/p\u003e\n"]]],[],null,["# Users.dataSources.datasets: patch\n\n| **Note:** Requires [authorization](#auth).\n\nAdds data points to a dataset. The dataset need not be previously created.\nAll points within the given dataset will be returned with subsquent calls\nto retrieve this dataset. Data points can belong to more than one dataset.\n\n\u003cbr /\u003e\n\n\nThis method does not use patch semantics: the data points provided are\nmerely inserted, with no existing data replaced.\n[Try it now](#try-it).\n\nRequest\n-------\n\n### HTTP request\n\n```\nPATCH https://www.googleapis.com/fitness/v1/users/userId/dataSources/dataSourceId/datasets/datasetId\n```\n\n### Parameters\n\n| Parameter name | Value | Description |\n|----------------|----------|------------------------------------------------------------------------------------------------------------------------------|\n| **Path parameters** |||\n| `dataSourceId` | `string` | The data stream ID of the data source that created the dataset. |\n| `datasetId` | `string` | This field is not used, and can be safely omitted. |\n| `userId` | `string` | Patch a dataset for the person identified. Use `me` to indicate the authenticated user. Only `me` is supported at this time. |\n\n### Authorization\n\nThis request requires authorization with at least one of the following scopes:\n\n| Scope |\n|---------------------------------------------------------------------|\n| `https://www.googleapis.com/auth/fitness.activity.write` |\n| `https://www.googleapis.com/auth/fitness.location.write` |\n| `https://www.googleapis.com/auth/fitness.body.write` |\n| `https://www.googleapis.com/auth/fitness.nutrition.write` |\n| `https://www.googleapis.com/auth/fitness.blood_pressure.write` |\n| `https://www.googleapis.com/auth/fitness.blood_glucose.write` |\n| `https://www.googleapis.com/auth/fitness.oxygen_saturation.write` |\n| `https://www.googleapis.com/auth/fitness.body_temperature.write` |\n| `https://www.googleapis.com/auth/fitness.reproductive_health.write` |\n\nFor more information, see the [authentication and authorization](/fit/rest/v1/authorization) page.\n\n### Request body\n\nIn the request body, supply the relevant portions of a [Users.dataSources.datasets resource](/fit/rest/v1/reference/users/dataSources/datasets#resource), according to the rules of patch semantics, with the following properties:\n\n| Property name | Value | Description | Notes |\n|--------------------------|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------|\n| **Required Properties** ||||\n| `dataSourceId` | `string` | The data stream ID of the data source that created the points in this dataset. | |\n| `maxEndTimeNs` | `long` | The largest end time of all data points in this possibly partial representation of the dataset. Time is in nanoseconds from epoch. This should also match the second part of the dataset identifier. | |\n| `minStartTimeNs` | `long` | The smallest start time of all data points in this possibly partial representation of the dataset. Time is in nanoseconds from epoch. This should also match the first part of the dataset identifier. | |\n| `point[]` | `list` | A partial list of data points contained in the dataset, ordered by endTimeNanos. This list is considered complete when retrieving a small dataset and partial when patching a dataset or retrieving a dataset that is too large to include in a single response. | |\n| point[].`dataTypeName` | `string` | The data type defining the format of the values in this data point. | |\n| point[].`endTimeNanos` | `long` | The end time of the interval represented by this data point, in nanoseconds since epoch. | |\n| point[].`startTimeNanos` | `long` | The start time of the interval represented by this data point, in nanoseconds since epoch. | |\n| point[].`value[]` | `list` | Values of each data type field for the data point. It is expected that each value corresponding to a data type field will occur in the same order that the field is listed with in the data type specified in a data source. Only one of integer and floating point fields will be populated, depending on the format enum value within data source's type field. | |\n\nResponse\n--------\n\nIf successful, this method returns a [Users.dataSources.datasets resource](/fit/rest/v1/reference/users/dataSources/datasets#resource) in the response body.\n\nTry it!\n-------\n\n\nUse the APIs Explorer below to call this method on live data and see the response."]]