Assets
assets are images and files. Each belongs to one thing: a vehicle, location, showroom, test drive and so on. For vehicle images you normally read them through the vehicle; see Images.
Get one
Section titled “Get one”query Asset($id: uuid!) { assets_by_pk(id: $id) { id src alt type placement order classification stocked_vehicle_id created_at }}Images for several vehicles at once, for example after a sync:
query ImagesForVehicles($vehicleIds: [uuid!]!) { assets( where: { stocked_vehicle_id: { _in: $vehicleIds } is_public: { _eq: true } } order_by: [{ stocked_vehicle_id: asc }, { placement: asc }, { order: asc }] limit: 100 ) { stocked_vehicle_id src placement order }}A dealership location’s photos and logo:
query LocationImages($locationId: uuid!) { assets(where: { location_id: { _eq: $locationId }, is_public: { _eq: true } }) { src alt placement }}Fields worth knowing
Section titled “Fields worth knowing”| Field | Notes |
|---|---|
src |
Absolute URL. Resize ik.imagekit.io URLs with ?tr=w-800,f-auto. |
placement |
featured (hero), gallery, exterior, interior, logo… Free text. |
order |
Position within its placement, from 0. |
type |
image for photos. |
classification |
Detected shot: Front, Front34, Side, Rear34, Rear, Interior, Wheel, Other. |
is_public |
Safe to show publicly. |
stocked_vehicle_id, location_id, showroom_id, test_drive_id… |
What it belongs to. Only one is set. |