Wiki source code of Sellables

Version 11.1 by Shop Team on 2019/08/01 13:52

Hide last authors
Shop Team 10.1 1 = General Remarks =
Shop Team 4.1 2
Shop Team 11.1 3 These resources only work for shops that are based on the (new) Partner Area, not for legacy User Area-based shops. Terminology:
Shop Team 4.1 4
5 * 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**.
6 * 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.
7
8 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.
9
Shop Team 6.1 10 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>>url:https://en.wikipedia.org/wiki/Cross-origin_resource_sharing||shape="rect"]] policy interference and keeps your API key secure.
Shop Team 4.1 11
Shop Team 10.1 12 = List Resource =
Shop Team 4.1 13
Shop Team 10.1 14 |=(((
15 Method
16 )))|=(((
17 URL
18 )))|=(((
19 Example
20 )))
21 |(((
22 GET
23 )))|(((
24 {{{/api/v1/shops/<shopId>/sellables?page=<page>}}}
25 )))|(((
26 (% style="color: rgb(80,80,80);" %)[[https:~~/~~/api.spreadshirt.net/api/v1/shops/100488332/sellables?page=0>>url:https://api.spreadshirt.net/api/v1/shops/100488332/sellables?page=0||shape="rect"]]
27 )))
jns 1.1 28
29
Shop Team 4.1 30 Returns a paginated list of the shop's sellables in a format like this:
31
32 {{code language="js" title="Response Payload"}}
33 {
Shop Team 10.1 34 "count" : 4760,
Shop Team 5.1 35 "limit" : 48,
36 "offset" : 0,
37 "sellables" :
38 [
39 {
Shop Team 10.1 40 "sellableId" : "praawgg73zU5gzZN0gaM-812-7",
41 "ideaId" : "5d22f8ebb264a16f6b87fb6f",
Shop Team 5.1 42 "productTypeId" : "812",
43 "price" :
44 {
Shop Team 10.1 45 "amount" : 17.49,
Shop Team 5.1 46 "currencyId" : "1"
47 },
Shop Team 10.1 48 "name" : "I love you",
Shop Team 5.1 49 "tags" :
50 [
Shop Team 10.1 51 "Young wild and free",
52 "shop api",
53 "test",
54 "Young money",
55 "Loved",
56 "Lovestruck",
57 "Love with heart",
58 "Love hurts",
59 "Love",
60 "Love me",
61 "Youtube",
62 "migration",
63 "Your",
64 "You",
65 "Love parade"
Shop Team 5.1 66 ],
67 "previewImage" :
68 {
Shop Team 10.1 69 "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",
Shop Team 5.1 70 "type" : "MODEL"
71 },
72 "appearanceIds" :
73 [
74 "411",
75 "645",
Shop Team 10.1 76 "648",
Shop Team 5.1 77 "649",
Shop Team 10.1 78 "719",
Shop Team 5.1 79 "1",
Shop Team 10.1 80 "2",
Shop Team 5.1 81 "366",
Shop Team 10.1 82 "348",
83 "387",
Shop Team 5.1 84 "92",
85 "39",
86 "231",
87 "317",
88 "3",
89 "29",
Shop Team 10.1 90 "328",
91 "339"
Shop Team 5.1 92 ],
Shop Team 10.1 93 "defaultAppearanceId" : "2"
94 }
Shop Team 5.1 95 ]
Shop Team 4.1 96 }
97 {{/code}}
98
99 The fields are to be interpreted as follows:
100
Shop Team 10.1 101 (% class="wrapped" %)
Shop Team 4.1 102 |=(((
Shop Team 10.1 103 Fiel
Shop Team 4.1 104 )))|=(((
Shop Team 10.1 105 Description
Shop Team 4.1 106 )))
107 |(((
108 sellableId
109 )))|(((
110 Unique identifier for the sellable. Necessary to query the detail resource mentioned below as well as for the add-to-basket request.
111 )))
112 |(((
113 ideaId
114 )))|(((
115 Identifies the uploaded design. Necessary to query the detail resource but also useful to group content by design if desired.
116 )))
117 |(((
118 productTypeId
119 )))|(((
120 Identifies the 'type of garment' used. Can be used to lookup additional meta data from the product type resources described [[here>>doc:Inventory Resources]].
121 )))
122 |(((
123 price
124 )))|(((
125 Always in the currency of the shop. Check [[this>>doc:Price Formatting Guide]] for hints on how to format the price in a user-friendly way.
126 )))
127 |(((
128 name
129 )))|(((
130 The text you entered in the Partner Area.
131 )))
132 |(((
133 description
134 )))|(((
135 The text you entered in the Partner Area (optional).
136 )))
137 |(((
138 tags
139 )))|(((
140 The text you entered in the Partner Area (optional).
141 )))
142 |(((
143 previewImage
144 )))|(((
145 An image we deem best suited to represent the sellable on a list page.
146 )))
147 |(((
Shop Team 10.1 148 previewImage/url
Shop Team 4.1 149 )))|(((
150 The image url you can embed directly into your page.
151 )))
152 |(((
Shop Team 10.1 153 previewImage/type
Shop Team 4.1 154 )))|(((
155 Describes the type of image available from the url using one of the following values: PRODUCT, DESIGN, MODEL, ALTERNATIVE_MODEL.
156 )))
157 |(% colspan="1" %)(% colspan="1" %)
158 (((
159 appearanceIds
160 )))|(% colspan="1" %)(% colspan="1" %)
161 (((
162 The 'colors' a sellable currently has available for purchase. If you need more information on the colors, the product type resource [[here>>doc:Inventory Resources]] is useful.
163 )))
164 |(% colspan="1" %)(% colspan="1" %)
165 (((
166 defaultAppearanceId
167 )))|(% colspan="1" %)(% colspan="1" %)
168 (((
169 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.
170 )))
171
172
173 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).
174 This allows you to implement a custom navigation structure, filters, etc. according to your needs.
175
Shop Team 10.1 176 = Detail Resource =
Shop Team 4.1 177
Shop Team 10.1 178 |=(((
179 Method
180 )))|=(((
181 URL
182 )))|=(((
183 Example
184 )))
185 |(((
186 GET
187 )))|(((
188 {{{/api/v1/shops/<shopId>/sellables/<sellableId>?appearanceId=<appearanceId>&ideaId=<ideaId>}}}
189 )))|(((
190 (% style="color: rgb(80,80,80);" %)[[https:~~/~~/api.spreadshirt.net/api/v1/shops/100488332/sellables/praawgg73zU5gzZN0gaM-812-7?appearanceId=411&ideaId=5d22f8ebb264a16f6b87fb6f>>url:https://api.spreadshirt.net/api/v1/shops/100488332/sellables/praawgg73zU5gzZN0gaM-812-7?appearanceId=411&ideaId=5d22f8ebb264a16f6b87fb6f||shape="rect"]]
191 )))
Shop Team 4.1 192
Shop Team 10.1 193 \\
Shop Team 4.1 194
195 Returns detailed information on a specific sellable in a specific appearance in a format like this:
196
197 {{code language="js" title="Response Payload"}}
198 {
Shop Team 5.1 199 "sizeIds" :
200 [
201 "2",
202 "3",
203 "4",
204 "5",
205 "6",
206 "38",
207 "94",
208 "102"
209 ],
210 "images" :
211 [
212 {
Shop Team 10.1 213 "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",
Shop Team 5.1 214 "type" : "MODEL"
215 },
216 {
Shop Team 10.1 217 "url" : "https://image.spreadshirtmedia.net/image-server/v1/compositions/T812A2PA3811PT17X50Y96D163261757FS2991/views/1,width=650,height=650,appearanceId=411.jpg",
Shop Team 5.1 218 "type" : "DESIGN"
219 },
220 {
Shop Team 10.1 221 "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",
222 "type" : "MODEL"
Shop Team 5.1 223 },
224 {
Shop Team 10.1 225 "url" : "https://image.spreadshirtmedia.net/image-server/v1/products/T812A2PA3811PT17X50Y96D163261757FS2991/views/3,width=650,height=650,appearanceId=411.jpg",
Shop Team 5.1 226 "type" : "PRODUCT"
227 },
228 {
Shop Team 10.1 229 "url" : "https://image.spreadshirtmedia.net/image-server/v1/products/T812A2PA3811PT17X50Y96D163261757FS2991/views/4,width=650,height=650,appearanceId=411.jpg",
Shop Team 5.1 230 "type" : "PRODUCT"
231 },
232 {
Shop Team 10.1 233 "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",
Shop Team 5.1 234 "type" : "ALTERNATIVE_MODEL"
235 }
236 ],
Shop Team 10.1 237 "sellableId" : "praawgg73zU5gzZN0gaM-812-7",
238 "ideaId" : "5d22f8ebb264a16f6b87fb6f",
Shop Team 5.1 239 "productTypeId" : "812",
240 "price" :
241 {
Shop Team 10.1 242 "amount" : 17.49,
Shop Team 5.1 243 "currencyId" : "1"
244 },
Shop Team 10.1 245 "name" : "112016603 143175205 I love you",
Shop Team 5.1 246 "tags" :
247 [
Shop Team 10.1 248 "Young wild and free",
249 "shop api",
250 "test",
251 "Young money",
252 "Loved",
253 "Lovestruck",
254 "Love with heart",
255 "Love hurts",
256 "Love",
257 "Love me",
258 "Youtube",
259 "migration",
260 "Your",
261 "You",
262 "Love parade"
Shop Team 5.1 263 ],
264 "previewImage" :
265 {
Shop Team 10.1 266 "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",
Shop Team 5.1 267 "type" : "MODEL"
268 },
269 "appearanceIds" :
270 [
271 "411",
272 "645",
Shop Team 10.1 273 "648",
Shop Team 5.1 274 "649",
Shop Team 10.1 275 "719",
Shop Team 5.1 276 "1",
Shop Team 10.1 277 "2",
Shop Team 5.1 278 "366",
Shop Team 10.1 279 "348",
280 "387",
Shop Team 5.1 281 "92",
282 "39",
283 "231",
284 "317",
285 "3",
286 "29",
Shop Team 10.1 287 "328",
288 "339"
Shop Team 5.1 289 ],
Shop Team 10.1 290 "defaultAppearanceId" : "2"
Shop Team 4.1 291 }
292 {{/code}}
293
294 \\
295
296 Most of the fields are exactly the same as in the list resource and have the same semantics. Two additional fields are included:
297
Shop Team 10.1 298 (% class="wrapped" %)
Shop Team 4.1 299 |=(((
300 Field name
301 )))|=(((
302 Meaning
303 )))
304 |(((
305 sizeIds
306 )))|(((
307 Describes the sizes available for purchase for the sellable in this appearance. For more information on sizes, check the product type resource [[here>>doc:Inventory Resources]].
308 )))
309 |(((
310 images
311 )))|(((
312 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).
313 )))
314
315
316 Implementation remarks: It is not feasible to import these detail resources into your own data base (because the number of entries can skyrocket quickly).
317 Instead, it is recommended to request the API dynamically in an ad-hoc manner once a customer visits a detail page.
318
Shop Team 6.1 319 \\