از پارامترهای width یا height برای سفارشی کردن وضوح تصویر دانلود شده استفاده کنید. فقط یکی از این پارامترها باید مشخص شود. پارامتر دیگر به طور خودکار با توجه به نسبت تصویر دوربین مقیاس بندی می شود.
به عنوان مثال، اگر نسبت تصویر دوربین 4:3 است، برای دانلود تصویر دوربین با وضوح 480 در 360 عرض یا ارتفاع را مشخص کنید:
تاریخ آخرین بهروزرسانی 2025-08-23 بهوقت ساعت هماهنگ جهانی.
[[["درک آسان","easyToUnderstand","thumb-up"],["مشکلم را برطرف کرد","solvedMyProblem","thumb-up"],["غیره","otherUp","thumb-up"]],[["اطلاعاتی که نیاز دارم وجود ندارد","missingTheInformationINeed","thumb-down"],["بیشازحد پیچیده/ مراحل بسیار زیاد","tooComplicatedTooManySteps","thumb-down"],["قدیمی","outOfDate","thumb-down"],["مشکل ترجمه","translationIssue","thumb-down"],["مشکل کد / نمونهها","samplesCodeIssue","thumb-down"],["غیره","otherDown","thumb-down"]],["تاریخ آخرین بهروزرسانی 2025-08-23 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eThe \u003ccode\u003esdm.devices.traits.CameraEventImage\u003c/code\u003e trait enables retrieval of images associated with events from Nest devices like cameras and doorbells.\u003c/p\u003e\n"],["\u003cp\u003eUse the \u003ccode\u003eGenerateImage\u003c/code\u003e command with an event ID to receive a URL and token for downloading the corresponding event image.\u003c/p\u003e\n"],["\u003cp\u003eDownloaded images are temporary and expire 30 seconds after the event, requiring prompt retrieval.\u003c/p\u003e\n"],["\u003cp\u003eCustomize image resolution during download using \u003ccode\u003ewidth\u003c/code\u003e or \u003ccode\u003eheight\u003c/code\u003e parameters in the download URL.\u003c/p\u003e\n"],["\u003cp\u003ePotential errors include image expiration or invalid event IDs, necessitating careful handling and error checks.\u003c/p\u003e\n"]]],[],null,["\u003cbr /\u003e\n\nCameraEventImage Schema\n\n[Nest Cam (legacy)](/nest/device-access/api/camera) [Nest Hub Max](/nest/device-access/api/display) [Nest Doorbell (legacy)](/nest/device-access/api/doorbell)\n\n`sdm.devices.traits.CameraEventImage`\n\nThis trait belongs to any device that supports generation of images from events.\n\n\u003cbr /\u003e\n\nFields\n\n\nThere are no fields available for this trait.\n\n\u003cbr /\u003e\n\nCommands\n\n\u003cbr /\u003e\n\nGenerateImage\n\nProvides a URL to download a camera image from.\n\nThis command supports the following events:\n\n| Type | Element | Description |\n|-------|--------------------------------------------------------------------------------------------------|-------------------------------------------|\n| Event | [Motion](/nest/device-access/traits/device/camera-motion#motion) event of the CameraMotion trait | Motion has been detected by the camera. |\n| Event | [Person](/nest/device-access/traits/device/camera-person#person) event of the CameraPerson trait | A person has been detected by the camera. |\n| Event | [Sound](/nest/device-access/traits/device/camera-sound#sound) event of the CameraSound trait | Sound has been detected by the camera. |\n| Event | [Chime](/nest/device-access/traits/device/doorbell-chime#chime) event of the DoorbellChime trait | The doorbell has been pressed. |\n\nUse the `eventId` from a supported event in the command request to receive a download URL for the camera image related to that event.\n\n\u003cbr /\u003e\n\n| Event images expire 30 seconds after the event is published. Make sure to download the image prior to expiration.\n\nGenerateImage request and response \n\nRequest \n\n POST /enterprises/project-id/devices/device-id:executeCommand\n {\n \"command\" : \"sdm.devices.commands.CameraEventImage.GenerateImage\",\n \"params\" : {\n \"eventId\" : \"Z5F5uAKjOLCHumjqPhz3JaihCv...\"\n }\n }\n\nResponse \n\n```\n{\n \"results\" : {\n \"url\" : \"https://domain/sdm_event_snapshot/dGNUlTU2CjY5Y3VKaTZwR3o4Y1...\",\n \"token\" : \"g.0.eventToken\"\n }\n}\n```\n\nGenerateImage request fields\n\n| Field | Description | Data Type |\n|-----------|--------------------------------------------------------|---------------------------------------------------|\n| `eventId` | ID of the event to request a related camera image for. | `string` Example: \"Z5F5uAKjOLCHumjqPhz3JaihCv...\" |\n\nGenerateImage response fields\n\n| Field | Description | Data Type |\n|---------|---------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------|\n| `url` | The URL to download the camera image from. | `string` Example: \"https://\u003cvar translate=\"no\"\u003edomain\u003c/var\u003e/sdm_event_snapshot/dGNUlTU2CjY5Y3VKaTZwR3o4Y1...\" |\n| `token` | Token to use in the HTTP Authorization header when downloading the image. | `string` Example: \"g.0.eventToken\" |\n\n\u003cbr /\u003e\n\nDownload a camera image\n\nMake a GET call to the `url` from a\n[GenerateImage](/nest/device-access/traits/device/camera-event-image#generateimage)\ncommand response, using the\n`token` in the HTTP Authorization header with Basic authorization, to download the\ncamera image: \n\n curl -H \"Authorization: Basic g.0.eventToken\" \\\n https://\u003cvar translate=\"no\"\u003edomain\u003c/var\u003e/sdm_event_snapshot/dGNUlTU2CjY5Y3VKaTZwR3o4Y1...\n\nUse `width` or `height` query parameters to customize the resolution of the\ndownloaded image. Only one of these parameters need to specified. The other parameter is scaled\nautomatically according to the camera's aspect ratio.\n\nFor example, if the camera's aspect ratio is 4:3, to download the camera image with a resolution\nof 480 x 360 specify either the width or the height: \n\nWidth \n\n curl -H \"Authorization: Basic g.0.eventToken\" \\\n https://\u003cvar translate=\"no\"\u003edomain\u003c/var\u003e/sdm_event_snapshot/dGNUlTU2CjY5Y3VKaTZwR3o4Y1...?width=480\n\nHeight \n\n curl -H \"Authorization: Basic g.0.eventToken\" \\\n https://\u003cvar translate=\"no\"\u003edomain\u003c/var\u003e/sdm_event_snapshot/dGNUlTU2CjY5Y3VKaTZwR3o4Y1...?height=360\n\nOther restrictions to the download URL apply:\n\n- If both parameters are provided in the URL, `width` is used and `height` is ignored.\n- If neither parameter is provided in the URL, a default value of 480 is chosen for the `width`.\n\nSee the\n[CameraImage](/nest/device-access/traits/device/camera-image) trait for information on image\nproperties.\n\n\nErrors\n\nThe following error code(s) may be returned in relation to this trait:\n\n| Error Message | RPC | Troubleshooting |\n|---------------------------------------------------|-----------------------|-------------------------------------------------------------------------------------------------------------------|\n| Camera image is no longer available for download. | `DEADLINE_EXCEEDED` | Event images expire 30 seconds after the event is published. Make sure to download the image prior to expiration. |\n| Event id does not belong to the camera. | `FAILED_PRECONDITION` | Use the correct `eventID` returned by the camera event. |\n\nSee the [API Error Code Reference](/nest/device-access/reference/errors/api) for\nthe full list of API error codes.\n\n\u003cbr /\u003e"]]