REST Resource: sessions
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
المرجع: PickingSession
تمثيل لجلسة مستخدم يمكنه خلالها اختيار الصور والفيديوهات باستخدام "صور Google"
تمثيل JSON |
{
"id": string,
"pickerUri": string,
"pollingConfig": {
object (PollingConfig )
},
"expireTime": string,
"pickingConfig": {
object (PickingConfig )
},
"mediaItemsSet": boolean
} |
الحقول |
id |
string
النتائج فقط. المعرّف الذي أنشأته Google لهذه الجلسة.
|
pickerUri |
string
النتائج فقط. عنوان URL المستخدَم لإعادة توجيه المستخدم إلى "صور Google" (على الويب) كي يتمكّن من اختيار الصور والفيديوهات للجلسة الحالية. لعرض هذه الصفحة بنجاح، يجب أن يكون المستخدم مسجّلاً الدخول إلى حساب Google الذي يملك هذه الجلسة في متصفّح الويب. لا يمكن فتح pickerUri في إطار iframe لأسباب تتعلق بالأمان.
|
pollingConfig |
object (PollingConfig )
النتائج فقط. الإعدادات المقترَحة التي يجب أن تستخدمها التطبيقات أثناء الاستعلام عن sessions.get لا تتم تعبئة هذا الحقل إلا إذا لم يتم اختيار عناصر وسائط لهذه الجلسة بعد (أي mediaItemsSet غير صحيح).
|
expireTime |
string (Timestamp format)
النتائج فقط. الوقت الذي ستنتهي فيه صلاحية الوصول إلى هذه الجلسة (وعناصر الوسائط التي تم اختيارها) يستخدم معيار RFC 3339، حيث يكون الناتج الذي يتم إنشاؤه دائمًا مُعدَّلاً وفقًا لقاعدة Z ويستخدم 0 أو 3 أو 6 أو 9 أرقام عشرية. يتم أيضًا قبول العناصر غير "Z". أمثلة: "2014-10-02T15:01:23Z" أو "2014-10-02T15:01:23.045123456Z" أو "2014-10-02T15:01:23+05:30"
|
pickingConfig |
object (PickingConfig )
اختياريّ. إعدادات اختيار الصور لتجربة اختيار المستخدم أثناء هذه الجلسة يحدّد تطبيق العميل هذا عند استدعاء sessions.create ، ولا يمكن تعديله بعد ذلك (بدون إنشاء جلسة جديدة).
|
mediaItemsSet |
boolean
النتائج فقط. في حال ضبط القيمة على true ، يعني ذلك أنّه تم اختيار عناصر وسائط لهذه الجلسة ويمكن لتطبيقك طلب قائمة عناصر الوسائط التي تم اختيارها من خلال mediaItems.list .
|
PollingConfig
إعدادات طلب البيانات من واجهة برمجة التطبيقات
تمثيل JSON |
{
"pollInterval": string,
"timeoutIn": string
} |
الحقول |
pollInterval |
string (Duration format)
النتائج فقط. الوقت المُقترَح بين طلبات الاستطلاع المدة بالثواني مع ما يصل إلى تسعة أرقام كسور، وتنتهي بـ "s ". مثال: "3.5s" .
|
timeoutIn |
string (Duration format)
النتائج فقط. مدة الوقت التي يجب بعدها أن يتوقف العميل عن الاستطلاع تشير القيمة 0 إلى أنّه يجب على العميل إيقاف الاستطلاع إذا لم يسبق له ذلك. المدة بالثواني مع ما يصل إلى تسعة أرقام كسور، وتنتهي بـ "s ". مثال: "3.5s" .
|
PickingConfig
الإعدادات التي يحدّدها العميل لتجربة اختيار المستخدم خلال هذه الجلسة
تمثيل JSON |
{
"maxItemCount": string
} |
الحقول |
maxItemCount |
string (int64 format)
اختياريّ. الحد الأقصى لعدد العناصر التي يمكن للمستخدم اختيارها خلال هذه الجلسة. يتم ضبط القيمة تلقائيًا على 2000 في حال عدم تحديدها. في حال عدم تحديد قيمة أو ضبطها على 0، يمكن اختيار 2000 عنصر كحد أقصى. سيتم فرض القيم التي تزيد عن 2000 لتكون 2000. ستؤدي القيم السلبية إلى ظهور خطأ INVALID_ARGUMENT .
|
الطُرق |
|
إنشاء جلسة جديدة يمكن للمستخدم خلالها اختيار الصور والفيديوهات للوصول إليها من خلال جهة خارجية |
|
لحذف الجلسة المحدّدة. |
|
تستردّ هذه الدالة معلومات عن الجلسة المحدّدة. |
إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 2.0. للاطّلاع على التفاصيل، يُرجى مراجعة سياسات موقع Google Developers. إنّ Java هي علامة تجارية مسجَّلة لشركة Oracle و/أو شركائها التابعين.
تاريخ التعديل الأخير: 2025-07-25 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-07-25 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003eGoogle Photos Picker API provides sessions for users to select photos and videos.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003ePickingSession\u003c/code\u003e resource represents the user's selection session, including a URI to redirect users to Google Photos for picking media.\u003c/p\u003e\n"],["\u003cp\u003eApplications can poll the API using the recommended \u003ccode\u003ePollingConfig\u003c/code\u003e to check for session updates and retrieve selected media items.\u003c/p\u003e\n"],["\u003cp\u003eSessions have an expiration time and can be programmatically created, retrieved, and deleted using the API methods.\u003c/p\u003e\n"]]],["A `PickingSession` represents a user's photo/video selection process in Google Photos, identified by a unique ID. It provides a `pickerUri` to direct users to Google Photos for media selection. `PollingConfig` defines API polling parameters with `pollInterval` and `timeoutIn`. A session expires at a specified `expireTime`, after which access ends. Once `mediaItemsSet` is true, selected media can be requested. Methods allow to `create`, `get` and `delete` sessions.\n"],null,["# REST Resource: sessions\n\n- [Resource: PickingSession](#PickingSession)\n - [JSON representation](#PickingSession.SCHEMA_REPRESENTATION)\n- [PollingConfig](#PollingConfig)\n - [JSON representation](#PollingConfig.SCHEMA_REPRESENTATION)\n- [PickingConfig](#PickingConfig)\n - [JSON representation](#PickingConfig.SCHEMA_REPRESENTATION)\n- [Methods](#METHODS_SUMMARY)\n\nResource: PickingSession\n------------------------\n\nRepresentation of a user session during which the user can pick photos and videos using Google Photos.\n\n| JSON representation |\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"id\": string, \"pickerUri\": string, \"pollingConfig\": { object (/photos/picker/reference/rest/v1/sessions#PollingConfig) }, \"expireTime\": string, \"pickingConfig\": { object (/photos/picker/reference/rest/v1/sessions#PickingConfig) }, \"mediaItemsSet\": boolean } ``` |\n\n| Fields ||\n|-----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `id` | `string` Output only. The Google-generated identifier for this session. |\n| `pickerUri` | `string` Output only. The URI used to redirect the user to Google Photos (on web) so they can pick photos and videos for the current session. To view this page successfully, the user must be logged into the Google account that owns this session in their web browser. The `pickerUri` cannot be opened in an iframe due to security reasons. |\n| `pollingConfig` | `object (`[PollingConfig](/photos/picker/reference/rest/v1/sessions#PollingConfig)`)` Output only. The recommended configuration that applications should use while polling `sessions.get`. This field is only populated if media items have not yet been picked for this session (i.e., `mediaItemsSet` is false). |\n| `expireTime` | `string (`[Timestamp](https://protobuf.dev/reference/protobuf/google.protobuf/#timestamp)` format)` Output only. Time when access to this session (and its picked media items) will expire. Uses RFC 3339, where generated output will always be Z-normalized and uses 0, 3, 6 or 9 fractional digits. Offsets other than \"Z\" are also accepted. Examples: `\"2014-10-02T15:01:23Z\"`, `\"2014-10-02T15:01:23.045123456Z\"` or `\"2014-10-02T15:01:23+05:30\"`. |\n| `pickingConfig` | `object (`[PickingConfig](/photos/picker/reference/rest/v1/sessions#PickingConfig)`)` Optional. Photo-picking configuration for the user's picking experience during this session. This is specified by the client application when calling `sessions.create`, and cannot be modified after the fact (without creating a new session). |\n| `mediaItemsSet` | `boolean` Output only. If set to `true`, media items have been picked for this session and your application can request the list of picked media items via `mediaItems.list`. |\n\nPollingConfig\n-------------\n\nConfiguration for polling the API.\n\n| JSON representation |\n|---------------------------------------------------------|\n| ``` { \"pollInterval\": string, \"timeoutIn\": string } ``` |\n\n| Fields ||\n|----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `pollInterval` | `string (`[Duration](https://protobuf.dev/reference/protobuf/google.protobuf/#duration)` format)` Output only. Recommended time between poll requests. A duration in seconds with up to nine fractional digits, ending with '`s`'. Example: `\"3.5s\"`. |\n| `timeoutIn` | `string (`[Duration](https://protobuf.dev/reference/protobuf/google.protobuf/#duration)` format)` Output only. The length of time after which the client should stop polling. A value of 0 indicates that the client should stop polling if it hasn't already. A duration in seconds with up to nine fractional digits, ending with '`s`'. Example: `\"3.5s\"`. |\n\nPickingConfig\n-------------\n\nClient-specified configuration for the user's picking experience during this session.\n\n| JSON representation |\n|------------------------------------|\n| ``` { \"maxItemCount\": string } ``` |\n\n| Fields ||\n|----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `maxItemCount` | `string (`[int64](https://developers.google.com/discovery/v1/type-format)` format)` Optional. The maximum number of items that the user can pick during this session. Defaults to 2000 if not specified. If unspecified or set to 0, at most 2000 items can be picked. Values above 2000 will be coerced to 2000. Negative values will result in an `INVALID_ARGUMENT` error. |\n\n| Methods ------- ||\n|----------------------------------------------------------------|--------------------------------------------------------------------------------------------------|\n| ### [create](/photos/picker/reference/rest/v1/sessions/create) | Generates a new session during which the user can pick photos and videos for third-party access. |\n| ### [delete](/photos/picker/reference/rest/v1/sessions/delete) | Deletes the specified session. |\n| ### [get](/photos/picker/reference/rest/v1/sessions/get) | Retrieves information about the specified session. |"]]