Wocart
Wocart API

Media

Server

Serve a media file

GET
https://api.wocart.store
/media/{key}

A file of the store's media, for a store whose server serves its media itself (direct delivery — local development). Public, cached as immutable. On a store whose host delivers its own files, every key answers 404: use the URL the API gives.

Serve a media file › path Parameters

key
​string · required

A Media Key, e.g. products/3f2a9c0b1d2e4f5061728394a5b6c7d8.webp

Serve a media file › Responses

The file, with its Content-Type

No data returned

Ticket an image upload

POST
https://api.wocart.store
/api/media/uploads
X-API-Key (header)

Records a pending upload and answers how the browser sends the file (send). Then call POST /api/media/uploads/{id}/complete; the image's key is attachable once complete.

Ticket an image upload › Request Body

folder
​string · enum · required

products (gallery, categories, the logo, rich text, apps) or landing (landing-page stacks)

Enum values:
products
landing
contentType
​string · enum · required
Enum values:
image/jpeg
image/png
image/webp
image/gif
bytes
​integer · min: 1 · max: 10485760 · required

The file's exact size

Ticket an image upload › Responses

The ticket

success
​boolean · required
​UploadTicket · required

Send a relayed upload's bytes

PUT
https://api.wocart.store
/api/media/uploads/{id}/content
X-API-Key (header)

For a relay ticket only: the file's bytes, no larger than the ticket's size, of its type. Then complete the upload.

Send a relayed upload's bytes › path Parameters

id
​string · required

The ticket's mediaId

The ticket's mediaId

Send a relayed upload's bytes › Request Body

string · binary

Send a relayed upload's bytes › Responses

Stored; complete the upload

No data returned

Complete an image upload

POST
https://api.wocart.store
/api/media/uploads/{id}/complete
X-API-Key (header)

Confirms the file with the store's host. Completing twice answers the same image.

Complete an image upload › path Parameters

id
​string · required

The ticket's mediaId

The ticket's mediaId

Complete an image upload › Request Body

hostRef
​string | null

For a form ticket: the fileId the host answered

width
​integer | null · min: 1

The image's width as the browser measured it

height
​integer | null · min: 1

The image's height as the browser measured it

Complete an image upload › Responses

The image, ready

success
​boolean · required
data
​MediaImage · required