Spreadshirt provides several ways to offer an online shop experience to your customers:
- The standalone Spreadshop (this, for example). This application is officially developed, hosted and maintained by Spreadshirt. Running a Spreadshop requires zero technical skills and is always the recommended approach.
- An independent, custom built web application based on the Public Shop API described in this document. This interface is for web developers only (or people who can afford to hire one). Going for this approach is only feasible for people who have a solid understanding of server side & client side programming, HTTP, HTML and CSS.
The Public Shop API only works for shops that are based on the (new) Partner Area, not for legacy User Area-based shops. On top of that, an API key is required.
Note that not only the content you upload in the Partner Area, but also the shop settings affect the output of the Public Shop API. For example, enabling model images affects the image URLs returned by the API.
Partner Area shops are not based on the old domain entities articles and products anymore. Instead, they are based on ideas and sellables (sic!).
- 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.
- 22 July 2019: 1.0
- The field previewImage as well as the content of the images array have been changed from strings to objects. These objects now contain information about the image type.
- Introduced a legacy article mapping resource.
- 27 June 2019: Beta
- Beta release with request for feedback
Please provide your API key as described here. A signature or sessionId is not required.
Remember to set a user agent header naming your application and including its version. Example: "MyApp-1.0"
Client / Server
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.
Returns a paginated list of the shop's sellables in a format like this:
The fields are to be interpreted as follows:
|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.|
|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.|
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.
Returns detailed information on a specific sellable in a specific appearance in a format like this:
Most of the fields are exactly the same as in the list resource and have the same semantics. Two additional fields are included:
|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.
The basket resources generally still work as they used to. However, keep in mind that a sellable is a new domain entity and hence different from products and articles.
To put a sellable into a basket, use this payload fragment instead:
Note that the type property needs a different constant now and a shop tag needs to be sent as well.
Legacy article mapping resource
If your shop was subject to a migration from the old model (that was based on articles and was accessible through the User Area), you may still have deeplinks or internal data structures referencing these now-gone articles.
To ease the transition phase, we provide the following resource that allows you to find the corresponding sellable your article was migrated to:
The response contains the identifiers necessary to make the connection between old and new domain entities.
There is an example integration of this API available here.
It shows a draft of a shop system written in php that might be helpful to understand the (list-page -> detail-page -> add-to-basket) workflow.