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

Variants

Here you can view a product variant or design a new one from an existing product variant.

When designing, information such as customizations, dimensions, files, etc. must be transferred. After that you will receive a new product variant that can be ordered.

List

Returns a collection of variants.

Filtering

You can filter your results as follows:

List variants for specified id(s)

  • /variants?filter[id]=1
  • /variants?filter[id]=1,2,3

List variants for a specified origin code

The filtering is not an exact search, it looks for a part in the attribute value.

  • /variants?filter[origin.sku]=42443

See: Pagination, Filtering

Example

Request

GET /variants HTTP/1.1

Response

{
    "data": [
        {
            "is_test": false,
            "id": 6,
            "total": 97.37,
            "price": 91,
            "tax": 6.37,
            "tax_rate": 7,
            "attributes": [
                {
                    "name": "color",
                    "value": "CadetBlue"
                },
                {
                    "name": "size",
                    "value": "M"
                }
            ],
            "origin": {
                "code": "0441837446362"
            },
            "media_id": 150,
            "views": {
                "back": {
                    "media_id": 151,
                    "composite_media_id": 155,
                    "customizations": []
                },
                "left": {
                    "media_id": 152,
                    "composite_media_id": 156,
                    "customizations": []
                },
                "front": {
                    "media_id": 150,
                    "composite_media_id": 154,
                    "customizations": []
                },
                "right": {
                    "media_id": 153,
                    "composite_media_id": 157,
                    "customizations": []
                }
            },
            "created_at": "2018-02-21T10:49:41+00:00",
            "updated_at": "2018-02-21T10:49:41+00:00"
        },
        {
            "is_test": false,
            "id": 10,
            "total": 191.59,
            "price": 161,
            "tax": 30.59,
            "tax_rate": 19,
            "attributes": [
                {
                    "name": "color",
                    "value": "DarkSalmon"
                },
                {
                    "name": "size",
                    "value": "XL"
                }
            ],
            "origin": {
                "code": "2673696529018"
            },
            "media_id": 165,
            "views": {
                "back": {
                    "composite_media_id": 167,
                    "customizations": []
                },
                "left": {
                    "composite_media_id": 168,
                    "customizations": []
                },
                "front": {
                    "composite_media_id": 166,
                    "customizations": []
                },
                "right": {
                    "composite_media_id": 169,
                    "customizations": []
                }
            },
            "created_at": "2018-02-21T10:49:42+00:00",
            "updated_at": "2018-02-21T10:49:42+00:00"
        },
        {
            "is_test": false,
            "id": 11,
            "total": 152.88,
            "price": 128.47,
            "tax": 24.41,
            "tax_rate": 19,
            "attributes": [
                {
                    "name": "color",
                    "value": "Navy"
                },
                {
                    "name": "size",
                    "value": "S"
                }
            ],
            "origin": {
                "code": "4244363429184"
            },
            "media_id": 180,
            "views": {
                "back": {
                    "composite_media_id": 182,
                    "customizations": []
                },
                "left": {
                    "composite_media_id": 183,
                    "customizations": []
                },
                "front": {
                    "composite_media_id": 181,
                    "customizations": []
                },
                "right": {
                    "composite_media_id": 184,
                    "customizations": []
                }
            },
            "created_at": "2018-02-21T10:49:42+00:00",
            "updated_at": "2018-02-21T10:49:42+00:00"
        },
        ...
    ],
    "links": {
        "first": "https://api.smake.io/v2/variants?page=1",
        "last": null,
        "prev": null,
        "next": "https://api.smake.io/v2/variants?page=2"
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "path": "https://api.smake.io/v2/variants",
        "per_page": 15,
        "to": 15
    }
}

Get

Returns the product variant with the id = x.

Example

Request

GET /variants/1 HTTP/1.1

Response

{
    "id": 1,
    "is_test": true,
    "total": 259.98,
    "price": 218.47,
    "tax": 41.51,
    "tax_rate": 19,
    "attributes": [
        {
            "name": "color",
            "value": "LightYellow"
        },
        {
            "name": "size",
            "value": "XL"
        }
    ],
    "origin": {
        "code": "0635579894134"
    },
    "media_id": 1094,
    "views": {
        "back": {
            "composite_media_id": 10680,
            "customizations": [
                {
                    "type": "dtg",
                    "production_media_id": 1,
                    "preview_media_id": 1001,
                    "dimension": {
                        "width": 100.55,
                        "height": 200.66
                    }
                },
                {
                    "type": "dtg",
                    "production_media_id": 2,
                    "preview_media_id": 1002,
                    "dimension": {
                        "width": 100.66,
                        "height": 200.12
                    }
                }
            ]
        },
        "front": {
            "composite_media_id": 1093,
            "customizations": [
                {
                    "type": "dtg",
                    "production_media_id": 2,
                    "preview_media_id": 1003,
                    "dimension": {
                        "width": 100.55,
                        "height": 200.66
                    }
                },
                {
                    "type": "dtg",
                    "production_media_id": 2,
                    "preview_media_id": 1004,
                    "dimension": {
                        "width": 1001.55,
                        "height": 2000.66
                    }
                },
                {
                    "type": "dtg",
                    "production_media_id": 2,
                    "preview_media_id": 1095,
                    "dimension": {
                        "width": 100.55,
                        "height": 200.66
                    }
                },
                {
                    "type": "dtg",
                    "production_media_id": 2,
                    "preview_media_id": 1096,
                    "dimension": {
                        "width": 1001.55,
                        "height": 2000.66
                    }
                }
            ]
        }
    },
    "created_at": "2017-09-28T14:48:05+00:00",
    "updated_at": "2017-09-28T14:48:05+00:00"
}

Design

When you design a product variant, this happens asynchronously and you have to use Polling or Webhooks. A new product variant is created implicitly. Therefore, you will already receive the new product variant ID in the header for later reference.

It is not possible to order this product variant before.

Designing a product variant is made possible by placing customizations on the corresponding view (e. g. front or back).

Field Type Description Required
views object Contains the views on which customizations are placed. Allowed are front, back, left and right. Views Object yes

Views Object

Field Type Description Required
front.composite_media_id integer The media id that represents the product image with customizations. See Media yes
front.customizations array Contains all customizations to be placed for the view. An array of Customizations Objects yes
front.additional_instructions array Contains all additional instructions to be placed for the view. An array of Additional Instruction Objects no

Customization Object

Field Type Description Required
type string Processing format of the customizations. Allowed is dtg yes
production_media_id integer The media id that contains the production file of the customizations. See Media yes
dimension object Dimension Object yes

Dimension Object

Field Type Description Required
width float The width of the customization in millimetres (mm) yes
height float The height of the customization in millimetres (mm) yes

Additional Instruction Object

Field Type Description Required
id integer The additional instruction id that represents the additional instruction. See Additional Instructions yes

Example

Request

POST /variants/136/design HTTP/1.1

{
    "views": {
        "front": {
            "composite_media_id": 1,
            "customizations": [
                {
                    "type": "dtg",
                    "production_media_id": 2,
                    "dimension": {
                        "width": 100.55,
                        "height": 200.66
                    }
                },
                {
                    "type": "dtg",
                    "production_media_id": 2,
                    "dimension": {
                        "width": 1001.55,
                        "height": 2000.66
                    }
                }
            ]
            "additional_instructions": [
                {
                    "id": 1
                }
            ]
        }
    }
}

Response

The X-Identifier is the new generated product variant ID for later reference.

HTTP/1.1 202 Accepted
Location https://api.smake.io/jobs/1
X-Identifier: 137