Wiki source code of Sellables

Version 13.1 by Shop Team on 2019/08/30 07:33

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