This is the documentation for 2021-02-23 but the latest version is 2022-02-01. You can switch versions in the menu.

Media

Under Media you can store image files for different areas and reuse them several times with reference to the Media Id.

Currently, media ids are required for the following areas:

Area Attributes Description
Design a variant composite_media_id Product picture with customization
Design a variant production_media_id Production file for customization

Upload

The following file formats are currently supported:

Type Options
JPG/JPEG RGB, 360dpi recommended
PNG RGB, transparency, 360dpi recommended

The maximum file size is 20MB.

Example

Request

POST /media HTTP/1.1
Content-Type: image/jpeg
Content-Length: 42840

raw content

Response

{
    "id": 1,
    "is_test": true,
    "file_name": "39b8196929f742e7bccab01a643b6524.jpeg",
    "size": 42840,
    "mime_type": "image/jpeg",
    "download_url": "https://api.smake.io/v2/media/1/download",
    "created_at": "2017-09-28T08:40:44+00:00",
    "updated_at": "2017-09-28T08:40:44+00:00"
}

List

Returns a collection of uploaded images.

Example

Request

GET /media HTTP/1.1

Response

{
    "data": [
        {
            "id": 1005,
            "is_test": true,
            "file_name": "39b8196929f742e7bccab01a643b6524.jpeg",
            "size": 42840,
            "mime_type": "image/jpeg",
            "download_url": "https://api.smake.io/v2/media/1005/download",
            "created_at": "2017-09-28T08:40:44+00:00",
            "updated_at": "2017-09-28T08:40:44+00:00"
        },
        {
            "id": 1006,
            "is_test": true,
            "file_name": "5d9de455299a4c369fcf719b677cf4cd.jpeg",
            "size": 42840,
            "mime_type": "image/jpeg",
            "download_url": "https://api.smake.io/v2/media/1006/download",
            "created_at": "2017-09-28T08:46:21+00:00",
            "updated_at": "2017-09-28T08:46:21+00:00"
        },
        {
            "id": 1007,
            "is_test": true,
            "file_name": "4efd66336f274163b6ef8c34a9c77570.jpeg",
            "size": 42840,
            "mime_type": "image/jpeg",
            "download_url": "https://api.smake.io/v2/media/1007/download",
            "created_at": "2017-09-28T08:46:26+00:00",
            "updated_at": "2017-09-28T08:46:26+00:00"
        },
        {
            "id": 1008,
            "is_test": true,
            "file_name": "391f3972c2bd473ba186752555b74cab.jpeg",
            "size": 42840,
            "mime_type": "image/jpeg",
            "download_url": "https://api.smake.io/v2/media/1008/download",
            "created_at": "2017-09-28T08:46:27+00:00",
            "updated_at": "2017-09-28T08:46:27+00:00"
        },
        {
            "id": 1009,
            "is_test": true,
            "file_name": "f868b1172fb74d0dbd6877f3e02f3386.jpeg",
            "size": 42840,
            "mime_type": "image/jpeg",
            "download_url": "https://api.smake.io/v2/media/1009/download",
            "created_at": "2017-09-28T08:46:28+00:00",
            "updated_at": "2017-09-28T08:46:28+00:00"
        },
       ...
    ],
    "links": {
        "first": "https://api.smake.io/v2/media?page=1",
        "last": null,
        "prev": null,
        "next": null
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "path": "https://api.smake.io/v2/media",
        "per_page": 25,
        "to": 16
    }
}

Get

Returns the resource for the uploaded image with id = x.

Example

Request

GET /media/1 HTTP/1.1

Response

{
    "id": 1,
    "is_test": true,
    "file_name": "39b8196929f742e7bccab01a643b6524.jpeg",
    "size": 42840,
    "mime_type": "image/jpeg",
    "download_url": "https://api.smake.io/v2/media/1/download",
    "created_at": "2017-09-28T08:40:44+00:00",
    "updated_at": "2017-09-28T08:40:44+00:00"
}

Download

Returns the image data for the uploaded image with the id = x as download.

For example, in PHP you can read the raw content with file_get_contents('php://input');.

Example

Request

GET /media/1/download HTTP/1.1

Response

raw content