Snapshot
Snapshot Models #
The Snapshot and SnapshotImage models represent images captured via the Canvas iOS application or uploaded directly through the coverages modal. A Snapshot groups related images together, while each SnapshotImage represents an individual image with presigned URL support for secure access.
Snapshots are primarily used for storing coverage card images. You can navigate from a Coverage to its Snapshot via the snapshot field, and from a Snapshot back to its Coverage via the coverage reverse relation.
Basic Usage #
from canvas_sdk.v1.data import Snapshot, SnapshotImage
# Get all snapshots
snapshots = Snapshot.objects.all()
# Get a specific snapshot
snapshot = Snapshot.objects.get(dbid=42)
# Get images for a snapshot
images = snapshot.images.all()
# Get all snapshot images
all_images = SnapshotImage.objects.all()
# Get all snapshot images for a specific coverage
from canvas_sdk.v1.data.coverage import Coverage
coverage = Coverage.objects.get(id="a74592ae8a6c4d0ebe0799d3fb3713d1")
if coverage.snapshot:
images = coverage.snapshot.images.all()
for image in images:
print(image.image_url)
Accessing Image Files #
The image_url property on SnapshotImage returns a presigned S3 URL for securely accessing the image file.
from canvas_sdk.v1.data import SnapshotImage
image = SnapshotImage.objects.exclude(image="").first()
# Returns a presigned S3 URL (valid for 1 hour)
url = image.image_url
Attributes #
Snapshot #
| Field Name | Type |
|---|---|
| dbid | Integer |
| created | DateTime |
| modified | DateTime |
| originator | CanvasUser |
| committer | CanvasUser |
| deleted | Boolean |
| entered_in_error | Boolean |
| title | String |
| description | String |
| coverage | Coverage |
| images | SnapshotImage[] |
SnapshotImage #
| Field Name | Type |
|---|---|
| dbid | Integer |
| created | DateTime |
| modified | DateTime |
| snapshot | Snapshot |
| image | String |
| title | String |
| instruction | String |
| tag | String |
| image_url | String (property) — presigned S3 URL |