Method: sessions.create
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
사용자가 서드 파티 액세스를 위해 사진 및 동영상을 선택할 수 있는 새 세션을 생성합니다.
사용자에게 활성 Google 포토 계정이 없는 경우 FAILED_PRECONDITION
오류가 반환됩니다.
클라이언트 애플리케이션이 사용자당 세션을 너무 많이 만들면 RESOURCE_EXHAUSTED
오류가 반환됩니다. 일반적인 상황에서는 클라이언트가 이러한 한도에 도달할 가능성이 없습니다. 하지만 클라이언트는 리소스 한도 내에서 사전에 유지되도록 각 세션 후에 sessions.delete
를 호출하는 것이 좋습니다.
사용자가 완료 버튼을 탭하여 선택 세션을 완료하면 pickerUri
가 더 이상 작동하지 않습니다. 사용자가 더 많은 사진을 선택할 수 있도록 새 세션을 만듭니다.
HTTP 요청
POST https://photospicker.googleapis.com/v1/sessions
URL은 gRPC 트랜스코딩 구문을 사용합니다.
쿼리 매개변수
매개변수 |
requestId |
string
선택사항입니다. 이 요청에 대해 클라이언트가 제공한 고유 식별자입니다. 이 ID는 제한된 입력 기기에서 OAuth 2.0 흐름을 사용하는 애플리케이션의 선택 환경을 간소화하는 데 사용됩니다. 이 ID는 UUID (버전 4) 문자열 형식이어야 하며 다음 요구사항을 충족해야 합니다.
- 사용자에 관한 민감한 식별 정보가 포함되어서는 안 됩니다.
- 16진수 32자리로 구성되며 하이픈으로 구분된 5개 그룹으로 나뉘고 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' (또는 8-4-4-4-12) 형식이어야 합니다.
|
요청 본문
요청 본문에 PickingSession
의 인스턴스가 포함됩니다.
응답 본문
성공한 경우 응답 본문에 새로 생성된 PickingSession
의 인스턴스가 포함됩니다.
승인 범위
다음 OAuth 범위가 필요합니다.
https://www.googleapis.com/auth/photospicker.mediaitems.readonly
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-07-25(UTC)
[null,null,["최종 업데이트: 2025-07-25(UTC)"],[[["\u003cp\u003eThis endpoint creates a session for users to select photos and videos for third-party access.\u003c/p\u003e\n"],["\u003cp\u003eA \u003ccode\u003eFAILED_PRECONDITION\u003c/code\u003e error occurs if the user lacks an active Google Photos account.\u003c/p\u003e\n"],["\u003cp\u003eExcessive session creation leads to a \u003ccode\u003eRESOURCE_EXHAUSTED\u003c/code\u003e error, though unlikely under normal use.\u003c/p\u003e\n"],["\u003cp\u003eClients should call \u003ccode\u003esessions.delete\u003c/code\u003e after each session to avoid exceeding resource limits.\u003c/p\u003e\n"],["\u003cp\u003eRequires the \u003ccode\u003ehttps://www.googleapis.com/auth/photospicker.mediaitems.readonly\u003c/code\u003e OAuth scope for authorization.\u003c/p\u003e\n"]]],["This describes the creation of a new session for users to grant third-party access to their photos and videos. It uses a `POST` request to `https://photospicker.googleapis.com/v1/sessions`. The request body contains a `PickingSession` instance, and a successful response returns a new `PickingSession`. Requires `photospicker.mediaitems.readonly` OAuth scope. Errors include `FAILED_PRECONDITION` for inactive accounts and `RESOURCE_EXHAUSTED` for excessive session creation. Deleting sessions with `sessions.delete` is recommended to manage resources.\n"],null,["# Method: sessions.create\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Query parameters](#body.QUERY_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n\nGenerates a new session during which the user can pick photos and videos for third-party access.\n\nIf the user doesn't have an active Google Photos account, a `FAILED_PRECONDITION` error is returned.\n\nIf the client application creates too many sessions per user, a `RESOURCE_EXHAUSTED` error is returned. Clients are unlikely to reach these limits under normal circumstances. However, clients are still recommended to call `sessions.delete` after each session, to proactively stay within resource limits.\n\nOnce [a user taps the **Done**](https://developers.google.com/photos/picker/guides/picking-experience#done_screen) button to complete a picking session, the `pickerUri` will no longer work. Create a new session to allow the user to pick more photos.\n\n### HTTP request\n\n`POST https://photospicker.googleapis.com/v1/sessions`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Query parameters\n\n| Parameters ||\n|-------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `requestId` | `string` Optional. A client-provided unique identifier for this request. This ID is used to enable the streamlined picking experience for applications using the OAuth 2.0 flow for limited-input devices. This ID must have the format of a UUID (version 4) string and follow these requirements: - Must not contain any sensitive identifying information about the user. - Must contain 32 hexadecimal characters divided into five groups separated by hyphens, in the format \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" (or 8-4-4-4-12). |\n\n### Request body\n\nThe request body contains an instance of [PickingSession](/photos/picker/reference/rest/v1/sessions#PickingSession).\n\n### Response body\n\nIf successful, the response body contains a newly created instance of [PickingSession](/photos/picker/reference/rest/v1/sessions#PickingSession).\n\n### Authorization scopes\n\nRequires the following OAuth scope:\n\n- `https://www.googleapis.com/auth/photospicker.mediaitems.readonly`"]]