Wiki source code of Sellables

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

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
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 13.1 42 "mainDesignId": "142648902",
Shop Team 5.1 43 "productTypeId" : "812",
44 "price" :
45 {
Shop Team 10.1 46 "amount" : 17.49,
Shop Team 5.1 47 "currencyId" : "1"
48 },
Shop Team 10.1 49 "name" : "I love you",
Shop Team 5.1 50 "tags" :
51 [
Shop Team 10.1 52 "Young wild and free",
53 "shop api",
54 "test",
55 "Young money",
56 "Loved",
57 "Lovestruck",
58 "Love with heart",
59 "Love hurts",
60 "Love",
61 "Love me",
62 "Youtube",
63 "migration",
64 "Your",
65 "You",
66 "Love parade"
Shop Team 5.1 67 ],
68 "previewImage" :
69 {
Shop Team 10.1 70 "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 71 "type" : "MODEL"
72 },
73 "appearanceIds" :
74 [
75 "411",
76 "645",
Shop Team 10.1 77 "648",
Shop Team 5.1 78 "649",
Shop Team 10.1 79 "719",
Shop Team 5.1 80 "1",
Shop Team 10.1 81 "2",
Shop Team 5.1 82 "366",
Shop Team 10.1 83 "348",
84 "387",
Shop Team 5.1 85 "92",
86 "39",
87 "231",
88 "317",
89 "3",
90 "29",
Shop Team 10.1 91 "328",
92 "339"
Shop Team 5.1 93 ],
Shop Team 10.1 94 "defaultAppearanceId" : "2"
95 }
Shop Team 5.1 96 ]
Shop Team 4.1 97 }
98 {{/code}}
99
100 The fields are to be interpreted as follows:
101
Shop Team 10.1 102 (% class="wrapped" %)
Shop Team 4.1 103 |=(((
Shop Team 14.1 104 Field
Shop Team 4.1 105 )))|=(((
Shop Team 10.1 106 Description
Shop Team 4.1 107 )))
108 |(((
109 sellableId
110 )))|(((
111 Unique identifier for the sellable. Necessary to query the detail resource mentioned below as well as for the add-to-basket request.
112 )))
113 |(((
114 ideaId
115 )))|(((
116 Identifies the uploaded design. Necessary to query the detail resource but also useful to group content by design if desired.
117 )))
Shop Team 13.1 118 |(% colspan="1" %)(% colspan="1" %)
119 (((
120 (% class="objectBox objectBox-string" %)mainDesignId
121 )))|(% colspan="1" %)(% colspan="1" %)
122 (((
Shop Team 15.1 123 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:API.Spreadshirt Public Shop API Documentation.API REST Resources.Design Details.WebHome]] in combination with this resource.
Shop Team 13.1 124 )))
Shop Team 4.1 125 |(((
126 productTypeId
127 )))|(((
Shop Team 16.1 128 Identifies the 'type of garment' used. Can be used to lookup additional meta data from the product type resources described [[here>>doc:API.Spreadshirt Public Shop API Documentation.API REST Resources.ProductType.WebHome]].
Shop Team 4.1 129 )))
130 |(((
131 price
132 )))|(((
Shop Team 18.1 133 Always in the currency of the shop. Check [[this>>doc:API.Spreadshirt Public Shop API Documentation.API Tutorials.Build your own shop system.Price Formatting Guide.WebHome]] for hints on how to format the price in a user-friendly way.
Shop Team 4.1 134 )))
135 |(((
136 name
137 )))|(((
138 The text you entered in the Partner Area.
139 )))
140 |(((
141 description
142 )))|(((
143 The text you entered in the Partner Area (optional).
144 )))
145 |(((
146 tags
147 )))|(((
148 The text you entered in the Partner Area (optional).
149 )))
150 |(((
151 previewImage
152 )))|(((
153 An image we deem best suited to represent the sellable on a list page.
154 )))
155 |(((
Shop Team 10.1 156 previewImage/url
Shop Team 4.1 157 )))|(((
158 The image url you can embed directly into your page.
159 )))
160 |(((
Shop Team 10.1 161 previewImage/type
Shop Team 4.1 162 )))|(((
163 Describes the type of image available from the url using one of the following values: PRODUCT, DESIGN, MODEL, ALTERNATIVE_MODEL.
164 )))
165 |(% colspan="1" %)(% colspan="1" %)
166 (((
167 appearanceIds
168 )))|(% colspan="1" %)(% colspan="1" %)
169 (((
Shop Team 16.1 170 The 'colors' a sellable currently has available for purchase. If you need more information on the colors, the product type resource [[here>>doc:API.Spreadshirt Public Shop API Documentation.API REST Resources.ProductType.WebHome]] is useful.
Shop Team 4.1 171 )))
172 |(% colspan="1" %)(% colspan="1" %)
173 (((
174 defaultAppearanceId
175 )))|(% colspan="1" %)(% colspan="1" %)
176 (((
177 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.
178 )))
179
Shop Team 15.1 180 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).
Shop Team 4.1 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 |=(((
Shop Team 14.1 311 Field
Shop Team 4.1 312 )))|=(((
313 Meaning
314 )))
315 |(((
316 sizeIds
317 )))|(((
Shop Team 16.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:API.Spreadshirt Public Shop API Documentation.API REST Resources.ProductType.WebHome]].
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 Implementation remarks: It is not feasible to import these detail resources into your own data base (because the number of entries can skyrocket quickly).
327 Instead, it is recommended to request the API dynamically in an ad-hoc manner once a customer visits a detail page.
328
Shop Team 6.1 329 \\