Get categories

Shop API v1
GET*base*/categories
GET*base*/categories/*categoryId*
Authentication:API key

Fetches a specific category referenced by its ID, or the full list of categories.

If the category-id parameter is specified, one category is fetched, otherwise all categories in the catalog are fetched.

Note that each returned category may contain nested subcategories in the “categories” attribute.

Parameters

categoryId

int
optional
Category ID as integer

Response

200 Content-type: application/json

object key

category object
required

The categoryId for the category object.

"18": {"name": "Category X"} for category ID 18.

name

string
The name of the category.

category

string
The ID of the category.

uri

string
The URI for this category.

completeUri

string
The complete URI for this category including parent categories.

metaKeywords metaDescription metaTitle

string
Meta data about the category.

localized

object

Information about localized versions of the category information. The key values in the list are the localization URIs, such as en, fr, sv etc.

"localized": {"sv": {"name": "Byxor"}} the Swedish category name is “Byxor”.

name

string
The name of the category in the localized language.

metaKeywords metaDescription metaTitle

string
optional
Optional strings that might have a localized translation in the language object.

categories

object

A list of nested category objects. The keys in the object is the categoryId of the nested category.

The objects in the list has the same parameters as the parent category.

products

array of strings
A list of productId for products in this category.

Response example

 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
HTTP/1.1 200 OK
Content-type: application/json

{
  "117": {
    "metaTitle" : "",
    "name" : "Category Name",
    "metaDescription" : "",
    "sortString" : "s-1",
    "localized" : {
       "sv" : {
          "name" : "Swedish Category Name",
          "metaTitle" : "Swedish Meta Title"
       },
    },
    "completeUri" : "category-name",
    "metaKeywords" : "",
    "category" : "117",
    "categories" : {
       "... <nested categories> ..."
    },
    "products" : [
       "665",
       "2165",
       "2177",
    ],
    "sortOrder" : "-1",
    "uri" : "category-name"
  }
}

Fetching a specific category using categoryId:

 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
HTTP/1.1 200 OK
Content-type: application/json

{
   "metaTitle" : "",
   "name" : "Category Name",
   "metaDescription" : "",
   "sortString" : "s-1",
   "localized" : {
      "sv" : {
         "name" : "Swedish Category Name",
         "metaTitle" : "Swedish Meta Title"
      },
   },
   "completeUri" : "category-name",
   "metaKeywords" : "",
   "category" : "117",
   "categories" : {
      "... <nested categories> ..."
   },
   "products" : [
      "665",
      "2165",
      "2177",
   ],
   "sortOrder" : "-1",
   "uri" : "category-name"
}

Error example

1
2
3
4
5
6
7
8
HTTP/1.1 404 Not Found
Content-type: application/json

{
   "errors" : {
      "category" : "not found"
   }
}