Sellables

Last modified by Shop Team on 2023/02/13 22:56

General Remarks

These resources only work for shops that are based on the (new) Partner Area, not for legacy User Area-based shops. Terminology:

  • an idea represents an image you uploaded in the Partner Area that you gave a name and added other meta data to. In the Partner Area this is loosely referred to as a design.
  • a sellable is a representation of an idea printed on a product type. Depending on the product range selected in the Partner Area, one idea might have 100+ sellables associated with it.

A sellable is thus something concrete that a customer can buy, while an idea represents a grouping of content mainly intended to make administration easier.

All requests to the Public Shop API should be made from your server and not from the browser. This allows you to leverage caching, avoids CORS policy interference and keeps your API key secure.

List Resource

Method

URL

Example

GET

/api/v1/shops/<shopId>/sellables?page=<page>

Returns a paginated list of the shop's sellables in a format like this:

Response Payload
{
  "count" : 4760,
  "limit" : 48,
  "offset" : 0,
  "sellables" :
      [
         {
           "sellableId" : "praawgg73zU5gzZN0gaM-812-7",
           "ideaId" : "5d22f8ebb264a16f6b87fb6f",
           "mainDesignId": "142648902",
           "productTypeId" : "812",
           "price" :
               {
                 "amount" : 17.49,
                 "currencyId" : "1"
               },
           "name" : "I love you",
           "tags" :
               [
                 "Young wild and free",
                 "shop api",
                 "test",
                 "Young money",
                 "Loved",
                 "Lovestruck",
                 "Love with heart",
                 "Love hurts",
                 "Love",
                 "Love me",
                 "Youtube",
                 "migration",
                 "Your",
                 "You",
                 "Love parade"
               ],
           "previewImage" :
               {
                 "url" : "https://image.spreadshirtmedia.net/image-server/v1/products/T812A2PA3811PT17X50Y96D163261757FS2991/views/1,width=500,height=500,appearanceId=2,crop=list,modelId=1111,version=1564481428.jpg",
                 "type" : "MODEL"
               },
           "appearanceIds" :
               [
                 "411",
                 "645",
                 "648",
                 "649",
                 "719",
                 "1",
                 "2",
                 "366",
                 "348",
                 "387",
                 "92",
                 "39",
                 "231",
                 "317",
                 "3",
                 "29",
                 "328",
                 "339"
               ],
           "defaultAppearanceId" : "2"
         }
      ]
}

The fields are to be interpreted as follows:

Field

Description

sellableId

Unique identifier for the sellable. Necessary to query the detail resource mentioned below as well as for the add-to-basket request.

ideaId

Identifies the uploaded design. Necessary to query the detail resource but also useful to group content by design if desired.

mainDesignId

Identifies the main image/design which is used for this Idea (usually the first design you add in the Partner Area). Can be used if you want to useĀ  the Designs Resource in combination with this resource.

productTypeId

Identifies the 'type of garment' used. Can be used to lookup additional meta data from the product type resources described here.

price

Always in the currency of the shop. Check this for hints on how to format the price in a user-friendly way.

name

The text you entered in the Partner Area.

description

The text you entered in the Partner Area (optional).

tags

The text you entered in the Partner Area (optional).

previewImage

An image we deem best suited to represent the sellable on a list page.

previewImage/url

The image url you can embed directly into your page.

previewImage/type

Describes the type of image available from the url using one of the following values: PRODUCT, DESIGN, MODEL, ALTERNATIVE_MODEL. 

appearanceIds

The 'colors' a sellable currently has available for purchase. If you need more information on the colors, the product type resource here is useful. 

defaultAppearanceId

The default 'color' you can set in the Partner Area. This is the color the previewImage is in. It also provides a good starting point when linking to a detail page.

Please note that this resource returns a maximum of 9504 sellables or 198 full pages. The page parameter must thus always be between 0 and 197 (inclusively).

Implementation remarks: For advanced implementations, it is usually best to import the content of the sellable list into your own data base in regular intervals (for example once every 24h).
This allows you to implement a custom navigation structure, filters, etc. according to your needs.

Detail Resource

Method

URL

Example

GET

/api/v1/shops/<shopId>/sellables/<sellableId>?appearanceId=<appearanceId>&ideaId=<ideaId>


Returns detailed information on a specific sellable in a specific appearance in a format like this:

Response Payload
{
  "sizeIds" :
      [
        "2",
        "3",
        "4",
        "5",
        "6",
        "38",
        "94",
        "102"
      ],
  "images" :
      [
         {
           "url" : "https://image.spreadshirtmedia.net/image-server/v1/products/T812A2PA3811PT17X50Y96D163261757FS2991/views/1,width=650,height=650,appearanceId=411,crop=detail,modelId=1111,version=1564481428.jpg",
           "type" : "MODEL"
         },
         {
           "url" : "https://image.spreadshirtmedia.net/image-server/v1/compositions/T812A2PA3811PT17X50Y96D163261757FS2991/views/1,width=650,height=650,appearanceId=411.jpg",
           "type" : "DESIGN"
         },
         {
           "url" : "https://image.spreadshirtmedia.net/image-server/v1/products/T812A2PA3811PT17X50Y96D163261757FS2991/views/2,width=650,height=650,appearanceId=411,crop=detail,modelId=1117,version=1564481457.jpg",
           "type" : "MODEL"
         },
         {
           "url" : "https://image.spreadshirtmedia.net/image-server/v1/products/T812A2PA3811PT17X50Y96D163261757FS2991/views/3,width=650,height=650,appearanceId=411.jpg",
           "type" : "PRODUCT"
         },
         {
           "url" : "https://image.spreadshirtmedia.net/image-server/v1/products/T812A2PA3811PT17X50Y96D163261757FS2991/views/4,width=650,height=650,appearanceId=411.jpg",
           "type" : "PRODUCT"
         },
         {
           "url" : "https://image.spreadshirtmedia.net/image-server/v1/products/T812A2PA3811PT17X50Y96D163261757FS2991/views/1,width=650,height=650,appearanceId=411,crop=detail,modelId=85,version=1564482744.jpg",
           "type" : "ALTERNATIVE_MODEL"
         }
      ],
  "sellableId" : "praawgg73zU5gzZN0gaM-812-7",
  "ideaId" : "5d22f8ebb264a16f6b87fb6f",
  "mainDesignId": "142648902",
  "productTypeId" : "812",
  "price" :
      {
        "amount" : 17.49,
        "currencyId" : "1"
      },
  "name" : "112016603 143175205 I love you",
  "tags" :
      [
        "Young wild and free",
        "shop api",
        "test",
        "Young money",
        "Loved",
        "Lovestruck",
        "Love with heart",
        "Love hurts",
        "Love",
        "Love me",
        "Youtube",
        "migration",
        "Your",
        "You",
        "Love parade"
      ],
  "previewImage" :
      {
        "url" : "https://image.spreadshirtmedia.net/image-server/v1/products/T812A2PA3811PT17X50Y96D163261757FS2991/views/1,width=500,height=500,appearanceId=2,crop=list,modelId=1111,version=1564481428.jpg",
        "type" : "MODEL"
      },
  "appearanceIds" :
      [
        "411",
        "645",
        "648",
        "649",
        "719",
        "1",
        "2",
        "366",
        "348",
        "387",
        "92",
        "39",
        "231",
        "317",
        "3",
        "29",
        "328",
        "339"
      ],
  "defaultAppearanceId" : "2"
}


Most of the fields are exactly the same as in the list resource and have the same semantics. Two additional fields are included:

Field

Meaning

sizeIds

Describes the sizes available for purchase for the sellable in this appearance. For more information on sizes, check the product type resource here.

images

A number of images giving an adequate overview over the sellable and it's properties in this appearance when displayed (ordered from most important to least important image). The exact number and shape of the images depend on your shop settings and the specifications you set when uploading the design. This object has the same structure as previewImage (mentioned in the list resource section).

Implementation remarks: It is not feasible to import these detail resources into your own data base (because the number of entries can skyrocket quickly).
Instead, it is recommended to request the API dynamically in an ad-hoc manner once a customer visits a detail page.


Tags:
Created by jns on 2019/07/15 12:14