سيتم إيقاف واجهات برمجة تطبيقات Google Fit نهائيًا في عام 2026، بما في ذلك واجهة برمجة التطبيقات Google Fit REST API. اعتبارًا من 1 أيار (مايو) 2024، لن يتمكّن المطوّرون من الاشتراك لاستخدام واجهات برمجة التطبيقات هذه.
للحصول على تعليمات حول واجهة برمجة التطبيقات أو المنصة التي تريد نقل البيانات إليها، يُرجى الانتقال إلى دليل نقل البيانات في Health Connect. للاطّلاع على مقارنة بين Health Connect وGoogle Fit API وFitbit Web API، يُرجى الانتقال إلى دليل مقارنة Health Connect.
مزيد من المعلومات حول Health Connect وكيفية الدمج مع واجهة برمجة التطبيقات
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 |
لمزيد من المعلومات، يُرجى الاطّلاع على صفحة المصادقة والتفويض.
نص الطلب
في نص الطلب، قدِّم الأجزاء ذات الصلة من مورد User.dataSources.datasets، وفقًا لقواعد دلالات رمز التصحيح، مع السمات التالية:
اسم الموقع |
القيمة |
الوصف |
ملاحظات |
الخصائص المطلوبة |
dataSourceId |
string |
رقم تعريف مصدر البيانات لمصدر البيانات الذي أنشأ النقاط في مجموعة البيانات هذه. |
|
maxEndTimeNs |
long |
أكبر وقت انتهاء لجميع نقاط البيانات في هذا التمثيل الجزئي لمجموعة البيانات. الوقت بالثواني من الحقبة. ويجب أن يتطابق هذا الجزء أيضًا مع الجزء الثاني من معرّف مجموعة البيانات. |
|
minStartTimeNs |
long |
أصغر وقت بدء لجميع نقاط البيانات في هذا التمثيل الجزئي لمجموعة البيانات. الوقت بالثواني من الحقبة. ويجب أن يتطابق هذا أيضًا مع الجزء الأول من معرّف مجموعة البيانات. |
|
point[] |
list |
يشير ذلك المصطلح إلى قائمة جزئية بنقاط البيانات المضمَّنة في مجموعة البيانات، ويتم ترتيبها حسب endTimeNanos. تعتبر هذه القائمة كاملة عند استرداد مجموعة بيانات صغيرة وجزئية عند تصحيح مجموعة بيانات أو استرداد مجموعة بيانات كبيرة جدًا بحيث لا يمكن تضمينها في استجابة واحدة. |
|
point[].dataTypeName |
string |
نوع البيانات الذي يحدد تنسيق القيم في نقطة البيانات هذه. |
|
point[].endTimeNanos |
long |
يشير ذلك المصطلح إلى وقت انتهاء الفاصل الزمني الذي تمثّله نقطة البيانات هذه، بالنانو ثانية منذ تاريخ بدء حساب الفترة. |
|
point[].startTimeNanos |
long |
وقت بدء الفاصل الزمني الذي تمثّله نقطة البيانات هذه، بالثواني منذ بدء حساب الفترة. |
|
point[].value[] |
list |
قيم كل حقل نوع بيانات لنقطة البيانات من المتوقع أن تحدث كل قيمة متوافقة مع حقل نوع البيانات بالترتيب نفسه الذي يتم إدراج الحقل به في نوع البيانات المحدّد في مصدر البيانات.
لن تتم تعبئة سوى حقل واحد من حقول الأعداد الصحيحة والنقاط العائمة، استنادًا إلى قيمة التعداد للتنسيق ضمن حقل نوع مصدر البيانات.
|
|
جرّب الآن
يمكنك استخدام "مستكشف واجهات برمجة التطبيقات" أدناه لطلب هذه الطريقة على البيانات المباشرة والاطّلاع على الردّ.
إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 2.0. للاطّلاع على التفاصيل، يُرجى مراجعة سياسات موقع Google Developers. إنّ Java هي علامة تجارية مسجَّلة لشركة Oracle و/أو شركائها التابعين.
تاريخ التعديل الأخير: 2025-07-25 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-07-25 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\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."]]