Users.dataSources.datasets: patch
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
نقاط داده را به یک مجموعه داده اضافه می کند. لازم نیست مجموعه داده قبلا ایجاد شده باشد. تمام نقاط در مجموعه داده داده شده با فراخوانی های بعدی برای بازیابی این مجموعه داده بازگردانده می شود. نقاط داده می توانند به بیش از یک مجموعه داده تعلق داشته باشند.
این روش از معنیشناسی وصله استفاده نمیکند: نقاط داده ارائه شده صرفاً درج میشوند، بدون اینکه دادههای موجود جایگزین شوند. اکنون آن را امتحان کنید .
درخواست کنید
درخواست HTTP
PATCH https://www.googleapis.com/fitness/v1/users/userId/dataSources/dataSourceId/datasets/datasetId
پارامترها
نام پارامتر | ارزش | توضیحات |
---|
پارامترهای مسیر |
dataSourceId | string | شناسه جریان داده منبع داده ای که مجموعه داده را ایجاد کرده است. |
datasetId | string | این فیلد استفاده نمی شود و می توان آن را با خیال راحت حذف کرد. |
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.datasets را با توجه به قوانین معنایی پچ، با ویژگیهای زیر عرضه کنید:
نام ملک | ارزش | توضیحات | یادداشت ها |
---|
ویژگی های مورد نیاز |
dataSourceId | string | شناسه جریان داده منبع داده که نقاط این مجموعه داده را ایجاد کرده است. | |
maxEndTimeNs | long | بزرگترین زمان پایان تمام نقاط داده در این نمایش احتمالاً جزئی از مجموعه داده. زمان بر حسب نانوثانیه از دوران است. این همچنین باید با قسمت دوم شناسه مجموعه داده مطابقت داشته باشد. | |
minStartTimeNs | long | کوچکترین زمان شروع تمام نقاط داده در این نمایش احتمالاً جزئی از مجموعه داده. زمان بر حسب نانوثانیه از دوران است. این همچنین باید با قسمت اول شناسه مجموعه داده مطابقت داشته باشد. | |
point[] | list | فهرستی جزئی از نقاط داده موجود در مجموعه داده، به ترتیب توسط endTimeNanos. این لیست هنگام بازیابی یک مجموعه داده کوچک کامل و در هنگام اصلاح یک مجموعه داده یا بازیابی مجموعه داده ای که برای گنجاندن در یک پاسخ بسیار بزرگ است جزئی در نظر گرفته می شود. | |
point[]. dataTypeName | string | نوع داده ای که فرمت مقادیر را در این نقطه داده تعیین می کند. | |
point[]. endTimeNanos | long | زمان پایان بازه نشان داده شده توسط این نقطه داده، در نانوثانیه از دوران. | |
point[]. startTimeNanos | long | زمان شروع بازه نشان داده شده توسط این نقطه داده، در نانوثانیه از دوران. | |
point[]. value[] | list | مقادیر هر فیلد نوع داده برای نقطه داده. انتظار می رود که هر مقدار مربوط به یک فیلد نوع داده به همان ترتیبی رخ دهد که فیلد در نوع داده مشخص شده در منبع داده فهرست شده است.
فقط یکی از فیلدهای عدد صحیح و ممیز شناور، بسته به مقدار فرمت enum در فیلد نوع منبع داده، پر می شود.
| |
آن را امتحان کنید!
از APIs Explorer زیر برای فراخوانی این روش در دادههای زنده و دیدن پاسخ استفاده کنید.
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی."],[[["\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."]]