أنت تعرض المستندات القديمة لواجهة برمجة التطبيقات Google Photos Library API.
Method: mediaItems.patch
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 2.0. للاطّلاع على التفاصيل، يُرجى مراجعة سياسات موقع Google Developers. إنّ Java هي علامة تجارية مسجَّلة لشركة Oracle و/أو شركائها التابعين.
تاريخ التعديل الأخير: 2025-07-25 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-07-25 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003eThis API updates an existing media item with a new description using a PATCH request.\u003c/p\u003e\n"],["\u003cp\u003eYou can only update the description of media items created via the API and owned by the user.\u003c/p\u003e\n"],["\u003cp\u003eThe request requires the \u003ccode\u003emediaItem.id\u003c/code\u003e as a path parameter and \u003ccode\u003eupdateMask\u003c/code\u003e with a value of \u003ccode\u003edescription\u003c/code\u003e as a query parameter.\u003c/p\u003e\n"],["\u003cp\u003eIt uses the \u003ccode\u003ehttps://www.googleapis.com/auth/photoslibrary.edit.appcreateddata\u003c/code\u003e authorization scope for access.\u003c/p\u003e\n"],["\u003cp\u003eThe request and response bodies utilize the \u003ccode\u003eMediaItem\u003c/code\u003e object for data transfer.\u003c/p\u003e\n"]]],["This documentation details how to update a media item's `description` via a PATCH request. The request uses the `mediaItem.id` path parameter to identify the target media. The `updateMask` query parameter, with the sole valid value \"description\", specifies the field to update. The request body contains the updated `MediaItem` data. A successful response returns the updated `MediaItem`. Authorization requires the `photoslibrary.edit.appcreateddata` OAuth scope.\n"],null,["# Method: mediaItems.patch\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Query parameters](#body.QUERY_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n- [Try it!](#try-it)\n\nUpdate the media item with the specified `id`. Only the `id` and `description` fields of the media item are read. The media item must have been created by the developer via the API and must be owned by the user.\n\n### HTTP request\n\n`PATCH https://photoslibrary.googleapis.com/v1/mediaItems/{mediaItem.id}`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|----------------|----------------------------------------------------------------------------------------------------------------------------------------|\n| `mediaItem.id` | `string` Identifier for the media item. This is a persistent identifier that can be used between sessions to identify this media item. |\n\n### Query parameters\n\n| Parameters ||\n|--------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `updateMask` | `string (`[FieldMask](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask)` format)` Required. Indicate what fields in the provided media item to update. The only valid value is `description`. This is a comma-separated list of fully qualified names of fields. Example: `\"user.displayName,photo\"`. |\n\n### Request body\n\nThe request body contains an instance of [MediaItem](/photos/library/legacy/reference/rest/v1/mediaItems#MediaItem).\n\n### Response body\n\nIf successful, the response body contains an instance of [MediaItem](/photos/library/legacy/reference/rest/v1/mediaItems#MediaItem).\n\n### Authorization scopes\n\nRequires the following OAuth scope:\n\n- `https://www.googleapis.com/auth/photoslibrary.edit.appcreateddata`"]]