examples/storefront Public
title: Uploading a product imagedescription: >- The merchant sends the image bytes to the API, which stores them in R2 under a hash of their content and points the product at the new key. Shoppers then load the image through the API.actors: [merchant, shopper]steps: - { from: merchant, to: storefront-api, label: "PUT /admin/products/:id/image, admin token" } - { from: storefront-api, to: db, label: check that the product exists } - { from: storefront-api, to: images, label: "put products/<id>/<hash>.<ext>, cached a year" } - { from: storefront-api, to: db, label: set the product's image_key } - { from: storefront-api, to: merchant, label: the product with its new image_url } - { from: shopper, to: storefront-api, label: GET /images/<key> } - { from: storefront-api, to: images, label: get the object } - { from: storefront-api, to: shopper, label: "the image, or 304 when the ETag matches" }