- About
- Getting started
- Guide
- API
-
Integrations
General
Ecommerce platforms
Ecommerce software
Uploading Media
Templates use media objects (e.g. a JPG or PNG file) to display images (e.g. the template image or a default image in a picture element). You can use the API to upload these images and reference them when creating and updating templates.
Please take into account the best practices when implementing this API call.
To create a media object, use the POST
http method to send a JSON
payload to the following endpoint:
1 | POST https://api.colorlab.io/v1/media?type={mediaType} |
The endpoint requires a query parameter type
which is equal to templates
, pictures
or uploads
. This parameter is used to indicate where the media object will be used.
The POST endpoint accepts a multipart/form-data
body that accepts following keys:
file
: contains the file dataContent-Type
: contains the content type of the file
Example response payload
1 | { |
The _id
property can be used to reference media objects when creating and updating templates.
Generating the signature
Create a verification string containing this data:shopId
Now use your API secret to compute a sha256 HMAC signature. You can test the output using online generators like https://www.freeformatter.com/hmac-generator.html.
Use the resulting value in the X-Colorlab-Api-Signature
header when sending requests to the above API endpoints.