Catalog

Last updated

Products#

One key difference between DTC API and prior APIs is that there is a limit to the number of products which can be fetched in a single request. In the session-mode a maximum of 40 products can be requested at a time. In no-session mode the restriction is relaxed to 100 products to allow for an easier time building caches.

General recommendations#

When listing products on the front-end we recommend to only select the fields required to build the page, and no more. Reducing the selected fields will reduce the size of the response, using less mobile data for users and decreasing response times on slow connections. You could achieve this either by adding each field to a query when you decide you need to as you build the application, or you could select all fields from the beginning and then remove the unused ones after.

Queries#

ActionCheckout APIShop APIDTC API
List productsGET productsGET productsdisplayItems
Search productsPOST productsPOST products/searchdisplayItems
Filter productsPOST productsPOST products/filter, GET products/{filter}/{value}displayItems
Product DetailsPOST product/{product}POST productsdisplayItem

In the following sections we will use a fragment called DisplayItemFields which allows us to re-use a selection of fields in multiple queries without duplicating them. Such a fragment may be defined like so:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 fragment DisplayItemFields on DisplayItem { id name uri productNumber brand { id name } collection { id name } productVariant { id name number } isPrimaryVariant description { formatted raw } metaTitle metaDescription metaKeywords weight weightUnit createdAt sizeChart { name horizontalLabels verticalLabels } price { formattedValue } showAsNew lowestPrice { originalPrice { formattedValue } price { formattedValue } periodDays } items { id name GTIN sku stock { available } } canonicalCategory { id sortOrder name uri } media { id source(sizeName:"standard") { url mediaSize { name } } thumb: source(sizeName:"thumb") { url mediaSize { name } } } translations { uri language { code } } subscriptionPlans { id name interval { value type } discount } }

List products#

1 2 3 4 5 6 7 8 9 10 11 12 13 14 query DisplayItems($page: Int = 1, $limit: Int = 40) { displayItems( page: $page limit: $limit ) { list { ...DisplayItemFields } userErrors { message path } } }

Search products#

Products can be searched by a number of different fields specified in the searchInFields part of the input. Some fields can be searched with fuzzy search. Such fields are defined with FUZZY_ prefixed in the name of the field, e.g. FUZZY_NAME.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 query SearchProducts($search: String!, $page: Int = 1, $limit: Int = 40) { displayItems( where: { search: $search, searchInFields: [ NAME, CATEGORY_NAME, SHORT_DESCRIPTION ] } page: $page limit: $limit ) { list { ...DisplayItemFields } userErrors { message path } pagination { currentPage nextPage hasNextPage previousPage lastPage } } }

Filter products#

The filters section of the displayItems response provides the fields that can be filtered on, along with information about how many matches there are for each filter and whether or not the filter was selected in the query. Variables:

1 2 3 4 5 6 7 8 9 10 11 12 ` "filters": [ { "key": "category", "values": ["1"] }, { "key": "brand", "values": ["1"] } ] }

Query:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 query FilterProducts($filters: [FilterInput!]!) { displayItems( where: { filters: $filters } ) { list { ...DisplayItemFields } filters { key anyAvailable selectedValues values { active count filterCount ... on CategoryFilterValue { category { id name } } ... on BrandFilterValue { brand { id name } } } } userErrors { message path } } }

Product details#

1 2 3 4 5 query ProductDetails($id: Int!) { displayItem(id: $id) { ...DisplayItemFields } }

Converting products between APIs#

DTC API format#

Note: not all fields are selected here

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 { "data": { "displayItems": { "list": [ { "id": 1, "name": "Test Product", "uri": "test-product", "productNumber": "123", "brand": { "id": 1, "name": "Brand" }, "collection": { "id": 1, "name": "Collection 1" }, "productVariant": { "id": 1445, "name": "Red", "number": "123456" }, "isPrimaryVariant": true, "description": { "formatted": "", "raw": "" }, "metaTitle": "", "metaDescription": "", "metaKeywords": "", "weight": 0, "weightUnit": "kg", "createdAt": "2020-02-01T12:00:00+0100", "sizeChart": { "name": "One Size", "horizontalLabels": [], "verticalLabels": [] }, "price": { "formattedValue": "100.00 SEK" }, "showAsNew": false, "lowestPrice": { "originalPrice": { "formattedValue": "100.00 SEK" }, "price": { "formattedValue": "100.00 SEK" }, "periodDays": 30 }, "items": [ { "id": "1-1", "name": "", "GTIN": "ABCDEFGHIJKL", "sku": "123456789", "stock": { "available": false } } ], "canonicalCategory": { "id": 8, "sortOrder": 0, "name": [ "Shop", "Women", "Shirts", "4-deep", "5-deep", "6-deep-2" ], "uri": "shop/women/shirts/4-deep/5-deep/6-deep-2" }, "media": [], "translations": [ { "uri": "test-product-sv", "language": { "code": "sv" } }, { "uri": "", "language": { "code": "en" } }, { "uri": "", "language": { "code": "de" } } ], "subscriptionPlans": [ { "id": 1, "name": "1 month subscription", "interval": { "value": 1, "type": "MONTH" }, "discount": 0 }, { "id": 2, "name": "3 months subscription", "interval": { "value": 3, "type": "MONTH" }, "discount": 0 }, { "id": 3, "name": "1 year subscription", "interval": { "value": 1, "type": "YEAR" }, "discount": 0 }, { "id": 4, "name": "6 months subscription", "interval": { "value": 6, "type": "MONTH" }, "discount": 0 }, { "id": 5, "name": "2 weeks subscription", "interval": { "value": 2, "type": "WEEK" }, "discount": 0 } ] } ], "userErrors": [] } }, "extensions": { "token": "8a8a6cb8-d0ca-4759-b018-3bab3a451999", "traceId": "ebddf5f9655edcea1c2ca6ee7cd0d1d2" } }

Checkout API Format

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 { "token": "1c9a9c029572878d20dd030f7f7ac2ee", "products": [ { "product": "1", "name": "Test Product", "uri": "test-product", "sku": "123456", "productSku": "123", "brand": "1", "brandName": "Brand", "brandUri": "brand", "collection": "1", "collectionName": "Collection 1", "collectionUri": "collection-1", "variantName": "Red", "excerpt": "", "excerptHtml": "", "description": "", "descriptionHtml": "", "metaTitle": "", "metaDescription": "", "metaKeywords": "", "stockUnit": "", "category": "8", "centraProduct": "1", "centraVariant": "1445", "itemQuantityMinimum": 1, "itemQuantityMultipleOf": 1, "price": "100.00 SEK", "priceAsNumber": 100, "priceBeforeDiscount": "100.00 SEK", "priceBeforeDiscountAsNumber": 100, "discountPercent": 0, "lowestPrice": [ { "periodDays": 30, "price": "100.00 SEK", "priceAsNumber": 100, "priceBeforeDiscount": "100.00 SEK", "priceBeforeDiscountAsNumber": 100 } ], "showAsOnSale": false, "showAsNew": false, "available": true, "itemTable": { "unit": "", "original": { "x": [ "" ], "y": [] }, "x": [ "" ], "y": [], "dividerSymbol": "x", "desc": "One Size" }, "items": [ { "sizeId": "1", "item": "1-1", "ean": "ABCDEFGHIJKL", "itemTableY": 0, "itemTableX": 0, "name": "", "upc": "", "sku": "123456789", "stock": "yes" } ], "categoryName": [ "Shop", "Women", "Shirts", "4-deep", "5-deep", "6-deep-2" ], "categoryUri": "shop/women/shirts/4-deep/5-deep/6-deep-2", "categories": [ { "pathIds": [], "uri": "shop", "sortOrder": 1000014, "name": [ "Shop" ], "category": "1" }, { "pathIds": [ "1" ], "uri": "shop/women", "sortOrder": 2000001, "name": [ "Shop", "Women" ], "category": "3" }, { "pathIds": [ "1", "3" ], "uri": "shop/women/shirts", "sortOrder": 3000020, "name": [ "Shop", "Women", "Shirts" ], "category": "4" }, { "pathIds": [ "1", "3", "4" ], "uri": "shop/women/shirts/4-deep", "sortOrder": 4000020, "name": [ "Shop", "Women", "Shirts", "4-deep" ], "category": "5" }, { "pathIds": [ "1", "3", "4", "5" ], "uri": "shop/women/shirts/4-deep/5-deep", "sortOrder": 5000020, "name": [ "Shop", "Women", "Shirts", "4-deep", "5-deep" ], "category": "6" }, { "pathIds": [ "1", "3", "4", "5", "6" ], "uri": "shop/women/shirts/4-deep/5-deep/6-deep", "sortOrder": 6000001, "name": [ "Shop", "Women", "Shirts", "4-deep", "5-deep", "6-deep" ], "category": "7" }, { "pathIds": [ "1", "3", "4", "5", "6" ], "uri": "shop/women/shirts/4-deep/5-deep/6-deep-2", "sortOrder": 7000001, "name": [ "Shop", "Women", "Shirts", "4-deep", "5-deep", "6-deep-2" ], "category": "8" } ], "media": { "standard": [ "<https://localhost/client/dynamic/images/1_2ebed79f43-screenshot-2024-01-11-at-161223.jpg>" ] }, "mediaObjects": [ { "media": 5, "sources": { "standard": [ { "url": "<https://localhost/client/dynamic/images/1_2ebed79f43-screenshot-2024-01-11-at-161223.jpg>" } ] }, "attributes": [] } ], "subscriptionPlans": [ { "intervalType": "month", "discountPercent": 0, "subscriptionPlan": 1, "name": "1 month subscription", "shippingType": "DYNAMIC", "id": "1", "intervalValue": 1, "status": "ACTIVE", "price": "100.00 SEK", "priceAsNumber": 100, "priceAfterDiscount": "100.00 SEK", "priceAfterDiscountAsNumber": 100 }, { "intervalType": "month", "discountPercent": 0, "subscriptionPlan": 2, "name": "3 months subscription", "shippingType": "DYNAMIC", "id": "2", "intervalValue": 3, "status": "ACTIVE", "price": "100.00 SEK", "priceAsNumber": 100, "priceAfterDiscount": "100.00 SEK", "priceAfterDiscountAsNumber": 100 }, { "intervalType": "year", "discountPercent": 0, "subscriptionPlan": 3, "name": "1 year subscription", "shippingType": "DYNAMIC", "id": "3", "intervalValue": 1, "status": "ACTIVE", "price": "100.00 SEK", "priceAsNumber": 100, "priceAfterDiscount": "100.00 SEK", "priceAfterDiscountAsNumber": 100 }, { "intervalType": "month", "discountPercent": 0, "subscriptionPlan": 4, "name": "6 months subscription", "shippingType": "DYNAMIC", "id": "4", "intervalValue": 6, "status": "ACTIVE", "price": "100.00 SEK", "priceAsNumber": 100, "priceAfterDiscount": "100.00 SEK", "priceAfterDiscountAsNumber": 100 }, { "intervalType": "week", "discountPercent": 0, "subscriptionPlan": 5, "name": "2 weeks subscription", "shippingType": "DYNAMIC", "id": "5", "intervalValue": 2, "status": "ACTIVE", "price": "100.00 SEK", "priceAsNumber": 100, "priceAfterDiscount": "100.00 SEK", "priceAfterDiscountAsNumber": 100 } ], "modifiedAt": "2024-02-14 14:54:32", "createdAt": "2020-02-01 12:00:00", "measurementChart": [], "countryOrigin": null, "relation": "variant", "relatedProducts": [ { "product": "10", "available": true, "media": [], "mediaObjects": [], "relation": "variant" } ] }, ], "productCount": 19, "filter": [] }

Shop API format

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 { "1": { "product": "1", "name": "Test Product", "uri": "test-product", "sku": "123456", "productSku": "123", "brand": "1", "brandName": "Brand", "collection": "1", "collectionName": "Collection 1", "silkProduct": "1", "silkProductName": "Test Product", "silkVariant": "1445", "silkVariantName": "Red", "folderName": null, "foldersName": "", "variantName": "Red", "primaryVariant": true, "excerpt": "", "description": "", "metaTitle": "", "metaDescription": "", "metaKeywords": "", "weight": 0, "weightUnit": "kg", "stockUnit": "", "supplierName": null, "createdAt": "2020-02-01 12:00:00", "measurementChart": "0", "measurementChartRows": {}, "harmCode": "", "harmCodeDescription": "", "countryOfOrigin": "", "countryOfOriginName": "", "markets": { "1": { "stockOfAllItems": "infinite", "pricesByPricelist": { "19": { "price": "100.00 SEK", "priceBeforeDiscount": "100.00 SEK", "priceReduction": "0.00 SEK", "priceAsNumber": 100, "priceBeforeDiscountAsNumber": 100, "priceReductionAsNumber": 0, "discountPercent": 0, "showAsOnSale": false, "newProduct": false, "lowestPrice": [ { "periodDays": 30, "price": "100.00 SEK", "priceAsNumber": 100, "priceBeforeDiscount": "100.00 SEK", "priceBeforeDiscountAsNumber": 100 } ] }, "20": { "price": "10.00 USD", "priceBeforeDiscount": "10.00 USD", "priceReduction": "0.00 USD", "priceAsNumber": 10, "priceBeforeDiscountAsNumber": 10, "priceReductionAsNumber": 0, "discountPercent": 0, "showAsOnSale": false, "newProduct": false, "lowestPrice": [ { "periodDays": 30, "price": "10.00 USD", "priceAsNumber": 10, "priceBeforeDiscount": "10.00 USD", "priceBeforeDiscountAsNumber": 10 } ] }, "23": { "price": "23 401 JPY", "priceBeforeDiscount": "32 400 JPY", "priceReduction": "9 000 JPY", "priceAsNumber": 23400.5, "priceBeforeDiscountAsNumber": 32400, "priceReductionAsNumber": 8999.5, "discountPercent": 28, "showAsOnSale": false, "newProduct": false, "lowestPrice": [ { "periodDays": 30, "price": "23 401 JPY", "priceAsNumber": 23400.5, "priceBeforeDiscount": "32 400 JPY", "priceBeforeDiscountAsNumber": 32400 } ] } } }, "3": { "stockOfAllItems": "infinite", "pricesByPricelist": { "19": { "price": "100.00 SEK", "priceBeforeDiscount": "100.00 SEK", "priceReduction": "0.00 SEK", "priceAsNumber": 100, "priceBeforeDiscountAsNumber": 100, "priceReductionAsNumber": 0, "discountPercent": 0, "showAsOnSale": false, "newProduct": false, "lowestPrice": [ { "periodDays": 30, "price": "100.00 SEK", "priceAsNumber": 100, "priceBeforeDiscount": "100.00 SEK", "priceBeforeDiscountAsNumber": 100 } ] }, "20": { "price": "10.00 USD", "priceBeforeDiscount": "10.00 USD", "priceReduction": "0.00 USD", "priceAsNumber": 10, "priceBeforeDiscountAsNumber": 10, "priceReductionAsNumber": 0, "discountPercent": 0, "showAsOnSale": false, "newProduct": false, "lowestPrice": [ { "periodDays": 30, "price": "10.00 USD", "priceAsNumber": 10, "priceBeforeDiscount": "10.00 USD", "priceBeforeDiscountAsNumber": 10 } ] }, "23": { "price": "32 400 JPY", "priceBeforeDiscount": "32 400 JPY", "priceReduction": "0 JPY", "priceAsNumber": 32400, "priceBeforeDiscountAsNumber": 32400, "priceReductionAsNumber": 0, "discountPercent": 0, "showAsOnSale": false, "newProduct": false, "lowestPrice": [ { "periodDays": 30, "price": "32 400 JPY", "priceAsNumber": 32400, "priceBeforeDiscount": "32 400 JPY", "priceBeforeDiscountAsNumber": 32400 } ] } } } }, "items": { "1-1": { "item": "1-1", "name": "", "ean": "ABCDEFGHIJKL", "upc": null, "sku": "123456789", "stockByMarket": { "1": "infinite", "3": "infinite" } } }, "canonicalCategory": 8, "canonicalUri": "shop/women/shirts/4-deep/5-deep/6-deep-2/test-product", "categories": { "1": { "category": 1, "primary": true, "sortOrder": 14, "name": "Shop", "uri": "shop", "uriForProduct": "shop/test-product" }, "3": { "category": 3, "primary": true, "sortOrder": 1, "name": "Women", "uri": "shop/women", "uriForProduct": "shop/women/test-product" }, "4": { "category": 4, "primary": true, "sortOrder": 20, "name": "Shirts", "uri": "shop/women/shirts", "uriForProduct": "shop/women/shirts/test-product" }, "5": { "category": 5, "primary": true, "sortOrder": 20, "name": "4-deep", "uri": "shop/women/shirts/4-deep", "uriForProduct": "shop/women/shirts/4-deep/test-product" }, "6": { "category": 6, "primary": true, "sortOrder": 20, "name": "5-deep", "uri": "shop/women/shirts/4-deep/5-deep", "uriForProduct": "shop/women/shirts/4-deep/5-deep/test-product" }, "7": { "category": 7, "primary": true, "sortOrder": 1, "name": "6-deep", "uri": "shop/women/shirts/4-deep/5-deep/6-deep", "uriForProduct": "shop/women/shirts/4-deep/5-deep/6-deep/test-product" }, "8": { "category": 8, "primary": true, "sortOrder": 1, "name": "6-deep-2", "uri": "shop/women/shirts/4-deep/5-deep/6-deep-2", "uriForProduct": "shop/women/shirts/4-deep/5-deep/6-deep-2/test-product" } }, "media": [ { "type": "image", "sources": { "mini": { "url": "<https://localhost/client/dynamic/images/1_2ebed79f43-screenshot-2024-01-11-at-161223-mini.jpg>", "width": 0, "height": 150, "mimeType": "image/jpeg" }, "thumb": { "url": "<https://localhost/client/dynamic/images/1_2ebed79f43-screenshot-2024-01-11-at-161223-thumb.jpg>", "width": 0, "height": 300, "mimeType": "image/jpeg" }, "standard": { "url": "<https://localhost/client/dynamic/images/1_2ebed79f43-screenshot-2024-01-11-at-161223.jpg>", "width": 0, "height": 600, "mimeType": "image/jpeg" }, "full": { "url": "<https://localhost/client/dynamic/images/1_2ebed79f43-screenshot-2024-01-11-at-161223-full.jpg>", "width": 0, "height": 1000, "mimeType": "image/jpeg" } }, "attributes": [] } ], "relatedProducts": [ { "product": "10", "relation": "silkProduct" } ], "localized": { "sv": { "uri": "test-product-sv", "categories": { "1": { "category": 1, "name": "Handla", "uri": "handla", "uriForProduct": "handla/test-product" } }, "canonicalUri": "handla/kvinna/skjortor/4-deep/5-deep/6-deep-2/test-product" } }, "subscriptionPlans": [ { "id": "1", "name": "1 month subscription", "intervalValue": 1, "intervalType": "month", "discountPercent": 0, "status": "ACTIVE", "shippingType": "DYNAMIC", "subscriptionPlan": 1, "priceByMarketAndPricelist": { "1": { "19": { "price": "100.00 SEK", "priceAsNumber": 100, "priceAfterDiscount": "100.00 SEK", "priceAfterDiscountAsNumber": 100 }, "20": { "price": "10.00 USD", "priceAsNumber": 10, "priceAfterDiscount": "10.00 USD", "priceAfterDiscountAsNumber": 10 }, "23": { "price": "23 401 JPY", "priceAsNumber": 23400.5, "priceAfterDiscount": "23 401 JPY", "priceAfterDiscountAsNumber": 23400.5 } }, "3": { "19": { "price": "100.00 SEK", "priceAsNumber": 100, "priceAfterDiscount": "100.00 SEK", "priceAfterDiscountAsNumber": 100 }, "20": { "price": "10.00 USD", "priceAsNumber": 10, "priceAfterDiscount": "10.00 USD", "priceAfterDiscountAsNumber": 10 }, "23": { "price": "32 400 JPY", "priceAsNumber": 32400, "priceAfterDiscount": "32 400 JPY", "priceAfterDiscountAsNumber": 32400 } } } } ] } }

Categories#

Queries#

ActionCheckout APIShop APIDTC API
List CategoriesGET categoriesGET categoriescategories
Category details-POST categories/{category}-

List categories#

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 query Categories($page: Int! = 1, $limit: Int! = 40) { categories(page: $page, limit: $limit, id:[1, 3]) { list { ...CategoryFields childCategories { ...CategoryFields childCategories { ...CategoryFields } } } pagination { currentPage nextPage hasNextPage previousPage lastPage } userErrors { message path } } } fragment CategoryFields on Category { id name uri metaTitle metaKeywords metaDescription sortOrder translations { language { code } name metaTitle metaKeywords metaDescription uri } parentCategory { id } }

Converting categories between APIs#

DTC API category format

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 { "data": { "categories": { "list": [ { "id": 1, "name": [ "Shop" ], "uri": "shop", "metaTitle": "Category 1", "metaKeywords": "Category 1", "metaDescription": "Category 1", "sortOrder": 0, "translations": [ { "language": { "code": "sv" }, "name": [ "Handla" ], "metaTitle": "titel på metan", "metaKeywords": "Category 1", "metaDescription": "beskrivning", "uri": "handla" }, { "language": { "code": "en" }, "name": [ "Shop" ], "metaTitle": "Category 1", "metaKeywords": "Category 1", "metaDescription": "Category 1", "uri": "shop" }, { "language": { "code": "de" }, "name": [ "Shop" ], "metaTitle": "Category 1", "metaKeywords": "Category 1", "metaDescription": "Category 1", "uri": "shop" } ], "parentCategory": null, "childCategories": [ { "parentCategory": { "id": 1 }, "id": 3, "name": [ "Shop", "Women" ], "uri": "shop/women", "metaTitle": "Category 3", "metaKeywords": "Category 3", "metaDescription": "Category 3", "sortOrder": 0, "translations": [ { "language": { "code": "sv" }, "name": [ "Handla", "Kvinna" ], "metaTitle": "För henne", "metaKeywords": "Category 3", "metaDescription": "Beskrivning Kvinna", "uri": "handla/kvinna" }, { "language": { "code": "en" }, "name": [ "Shop", "Women" ], "metaTitle": "Category 3", "metaKeywords": "Category 3", "metaDescription": "Category 3", "uri": "shop/women" }, { "language": { "code": "de" }, "name": [ "Shop", "Women" ], "metaTitle": "Category 3", "metaKeywords": "Category 3", "metaDescription": "Category 3", "uri": "shop/women" } ], "childCategories": [ { "parentCategory": { "id": 3 }, "id": 4, "name": [ "Shop", "Women", "Shirts" ], "uri": "shop/women/shirts", "metaTitle": "Category 4", "metaKeywords": "Category 4", "metaDescription": "Category 4", "sortOrder": 0, "translations": [ { "language": { "code": "sv" }, "name": [ "Handla", "Kvinna", "Skjortor" ], "metaTitle": "Skjortor för henne", "metaKeywords": "Category 4", "metaDescription": "Fina skjortor", "uri": "handla/kvinna/skjortor" }, { "language": { "code": "en" }, "name": [ "Shop", "Women", "Shirts" ], "metaTitle": "Category 4", "metaKeywords": "Category 4", "metaDescription": "Category 4", "uri": "shop/women/shirts" }, { "language": { "code": "de" }, "name": [ "Shop", "Women", "Shirts" ], "metaTitle": "Category 4", "metaKeywords": "Category 4", "metaDescription": "Category 4", "uri": "shop/women/shirts" } ] } ] } ] } ], "pagination": { "currentPage": 1, "nextPage": null, "hasNextPage": false, "previousPage": null, "lastPage": 1 }, "userErrors": [] } }, "extensions": { "token": "d92ec885-dbf7-41b7-9a66-befa6e0cdf33", "traceId": "37bdc584df680d93f713469e1de9a031" } }

Checkout API#

Checkout API Category format

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 { "token": "3ca73d14c473e736d2a244c964e6bd08", "categories": [ { "category": "1", "name": [ "Shop" ], "uri": "shop", "metaDescription": "Category 1", "metaTitle": "Category 1", "metaKeywords": "Category 1" }, { "category": "3", "name": [ "Shop", "Women" ], "uri": "shop/women", "metaDescription": "Category 3", "metaTitle": "Category 3", "metaKeywords": "Category 3", "inCategory": "1" }, ] }

Example conversion script:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 const convertCheckoutApiCategories = (dtcApiCatgories) => { return { token: dtcApiCatgories.extensions.token, categories: dtcApiCatgories.data.categories.list.map(category => { const {id, ...fields} = category; const cat = { category: id.toString(), name: category.name, uri: category.uri, metaDescription: category.metaDescription, metaTitle: category.metaTitle, metaKeywords: category.metaKeywords, }; if (category.parentCategory) { cat.inCategory = category.parentCategory.id.toString(); } return cat } ) } }

Shop API#

Shop API Categories format

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 { "1": { "category": "1", "name": "Shop", "uri": "shop", "sortOrder": 0, "metaTitle": "Category 1", "metaDescription": "Category 1", "metaKeywords": "Category 1", "sortString": "s0", "completeUri": "shop", "products": [ "8295", "8294", "8284", "8286", "8293", "8292", "8291", "8290", "8289", "8288", "8287", "8285", "8283", "1", "10", "7", "6", "1283", "53", "5", "52", "8282" ], "primaryProducts": [ "8295", "8294", "8284", "8286", "8293", "8292", "8291", "8290", "8289", "8288", "8287", "8285", "8283", "1", "10", "7", "6", "1283", "53" ], "localized": { "sv": { "name": "Handla", "uri": "handla", "metaTitle": "titel på metan", "metaDescription": "beskrivning", "completeUri": "handla" } }, "categories": { "3": { "category": "3", "name": "Women", "uri": "women", "sortOrder": 0, "inCategory": "1", "metaTitle": "Category 3", "metaDescription": "Category 3", "metaKeywords": "Category 3", "sortString": "s0s0", "completeUri": "shop/women", "products": [ "1", "10", "5", "6", "7", "52", "53", "1283", "8282" ], "primaryProducts": [ "1", "10", "5", "6", "7", "52", "53", "1283", "8282" ], "localized": { "sv": { "name": "Kvinna", "uri": "kvinna", "metaTitle": "För henne", "metaDescription": "Beskrivning Kvinna", "completeUri": "handla/kvinna" } }, "categories": { "4": { "category": "4", "name": "Shirts", "uri": "shirts", "sortOrder": 0, "inCategory": "3", "metaTitle": "Category 4", "metaDescription": "Category 4", "metaKeywords": "Category 4", "sortString": "s0s0s0", "completeUri": "shop/women/shirts", "products": [ "52", "53", "1", "10", "5", "6", "7", "1283", "8282" ], "primaryProducts": [ "52" ], "localized": { "sv": { "name": "Skjortor", "uri": "skjortor", "metaTitle": "Skjortor för henne", "metaDescription": "Fina skjortor", "completeUri": "handla/kvinna/skjortor" } } } } } } } }

Quering categories in the DTC API will not return displays (products), but categories and their data like ID and URI. In order to list displays from a specific category, you will need to make a separate request to displayItems filtered by category, or a lookupUri request.

Brands#

Queries#

ActionCheckout APIShop APIDTC API
List brandsGET brandsGET brandsbrands
Brand details-POST brands/{brand}-

List brands#

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 query Brands($page: Int! = 1, $limit: Int! = 40) { brands(page: $page, limit: $limit) { list { id name metaDescription metaKeywords metaTitle uri } pagination { currentPage nextPage hasNextPage previousPage lastPage } userErrors { message path } } }

Converting brands between APIs#

DTC API brand format

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 { "data": { "brands": { "list": [ { "id": 1, "uri": "brand-1", "name": "brand 1", "metaKeywords": "shoes, sport", "metaTitle": "Brand 1", "metaDescription": "These are some nice shoes" }, { "id": 3, "uri": "brand-3", "name": "brand 3", "metaKeywords": "shoes, sport", "metaTitle": "Brand 3", "metaDescription": "These are some nice shoes" } ] } }, "extensions": { "token": "d1e8305a-89ae-4de6-b051-405d79e67785", "traceId": "15246341c264506177b28d65e3cb1938" } }

Checkout API#

Checkout API Brand format

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 { "token": "28b3de5831de65c16336533d2efc9385", "brands": [ { "brand": "1", "name": "Brand", "uri": "brand", "metaDescription": "Brand 1", "metaKeywords": "Brand 1", "metaTitle": "Brand 1" }, { "brand": "3", "name": "Brand 3", "uri": "brand3", "metaDescription": "Brand 3", "metaKeywords": "Brand 3", "metaTitle": "Brand 3" } ] }

Example conversion script

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 const convertCheckoutApiBrands = (dtcApiBrands) => { return { token: dtcApiBrands.extensions.token, brands: dtcApiBrands.data.brands.list.map(brand => { const {id, ...fields} = brand; return { brand: id.toString(), ...fields } } ) } } const dtcApiBrands = getBrands(); const checkoutApiBrands = convertCheckoutApiBrands(dtcApiBrands);

Shop API#

Shop API Brand format

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 { "1": { "brand": "1", "name": "Brand", "uri": "brand", "metaDescription": "Brand 1", "metaKeywords": "Brand 1", "metaTitle": "Brand 1" }, "3": { "brand": "3", "name": "Brand 3", "uri": "brand3", "metaDescription": "Brand 3", "metaKeywords": "Brand 3", "metaTitle": "Brand 3" } }

Example conversion script

1 2 3 4 5 6 7 8 9 10 11 12 13 14 const convertShopApiBrands = (brands) => { const brandObject = {}; for (let i = 0; i < brands.length; i++) { let {id, ...fields} = brands[i]; id = id.toString() brandObject[id] = { brand: id, ...fields } } return brandObject; } const dtcApiBrands = getBrands(); const shopApiBrands = convertShopApiBrands(dtcApiBrands.data.brands.list);

Collections#

Queries#

ActionCheckout APIShop APIDTC API
List collectionsGET collectionsGET collectionscollections
Collection details-GET collections/{collection}collections

List collections#

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 query CollectionDetails($page: Int! = 1, $limit: Int! = 40) { collections(limit: $limit, page: $page) { list { id name uri } pagination { currentPage nextPage hasNextPage previousPage lastPage } userErrors { message path } } }

Converting collections between APIs#

DTC API collection format

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 { "data": { "collections": { "list": [ { "id": 1, "name": "Collection 1", "uri": "collection-1" }, { "id": 3, "name": "Collection 3", "uri": "collection-3" } ] } }, "extensions": { "token": "34527a4b-c793-4a54-aa1a-bba0eb1e19e1", "traceId": "592cce8d63d769099d5fe9b9b43d2fcf" } }

Checkout API#

Checkout API Collection format

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 { "token": "67282e5dcc1b3bee30045d6c0fe317bd", "collections": [ { "collection": "1", "name": "Collection 1", "uri": "collection-1" }, { "collection": "3", "name": "Collection 3", "uri": "collection-3" } ] }

Example conversion script

1 2 3 4 5 6 7 8 9 10 11 12 const dtcApiCollections = getCollections(); const checkoutApiCollections = { token: dtcApiCollections.extensions.token, collections: dtcApiCollections.data.collections.list.map(collection => { const {id, ...fields} = collection; return { collection: id.toString(), ...fields } } ) }

Shop API#

Shop API Collections format

1 2 3 4 5 6 7 8 9 10 11 12 { "1": { "collection": "1", "name": "Collection 1", "uri": "collection-1" }, "3": { "collection": "3", "name": "Collection 3", "uri": "collection-3" } }

Example conversion script

1 2 3 4 5 6 7 8 9 10 11 12 13 14 const convertToShopApiCollections = (collections) => { const collectionObject = {}; for (let i = 0; i < collections.length; i++) { let {id, ...fields} = collections[i]; id = id.toString() collectionObject[id] = { collection: id, ...fields } } return collectionObject; } const dtcApiCollections = getCollections(); const shopApiCollections = convertToShopApiCollections(dtcApiCollections.data.Collectionsf.list);

Warehouses#

Queries#

ActionCheckout APIShop APIDTC API
List WarehousesGET warehousesGET warehousesbrickAndMortars

There is no query in the DTC API to list warehouses in the same manner as the old APIs, but brickAndMortars will provide one with similar data.