Related Documents
Document Properties
Kbid2M7952
Last Modified26-Nov-2018
Added to KB01-Aug-2016
Public AccessEveryone
StatusOnline
Doc TypeReferences
Product
  • ICM 7.8
  • ICM 7.9
  • ICM 7.10

REST API - Get personalized category list


Note

Starting with 7.10 our REST API is documented using Swagger notation accessible at developer.cloud.intershop.com.

URI

/categories;spgid=<personalization_group_id>

/categories;spgid=<personalization_group_id>/<catID>

Http Method

GET

Short Description

Retrieve the top-level navigation data (list of top-level categories) or get info about (sub-) category. If page cache is enabled and spgid parameter is provided with a valid personalization group ID - Web Adapter caches this user specific response.

Query Parameters

For available parameters refer to:

Example Requests

/categories;spgid=gGqKDaxstt0000whc8sEo8Fd0000,

/categories;spgid=gGqKDaxstt0000whc8sEo8Fd0000?view=tree&limit=3,

/categories;spgid=gGqKDaxstt0000whc8sEo8Fd0000/Cameras-Camcorders,

/categories;spgid=gGqKDaxstt0000whc8sEo8Fd0000/Cameras-Camcorders?view=tree&limit=3

HTTP Status Codes

200 OK

404 Not Found (for /categories/<catID>)

Description

Equivalent to /categories (resp. /categories/<catID>/<subCatID>) but in addition "spgid" matrix parameter is provided and used for personalized caching. See REST API - Get top level categories (until 7.9) and REST API - Get info on (sub-)category (until 7.8) for different query parameters on /categories (resp. /categories/<catID>) resource.

The matrix parameter "spgid" is optional and it stands for personalization Group Based Caching. If not provided - the Web Adapter will NOT cache the response from the Rest call.

Response for anonymous customers is NOT cached, even if "spgid" parameter is provided. This means that anonymous customers always get not cached response and there is NO need to provide "spgid" if this rest call is executed without authorization. If "spgid" is provided in the URI for unregistered customer, then this "faulty" spgid is removed from the result URIs (URIs of the subcategories).

Response for the currently logged in customer is cached only if "spgid" parameter is provided and it contains a valid personalization group ID as a value. Usually this personalization group is retrieved from the session of the current user. If "spgid" is not provided in the URI for logged in customer, then the response is NOT cached by the webadapter but the result URIs (URIs of the subcategories) contain this "spgid" parameter in order to be cached when a call is performed based on the generated URIs. If the spgid is not valid then:

  • An empty list is returned (/categories);
  • An empty category resource is returned (/categories/<catID>).

Cartridge

app_sf_rest
Application

B2C Web Shop, SMB Web Shop

Product Version

7.8

Product To Version

 
Status

final

JSON

Request data format

Request related java object

n/a

Request data example

n/a

Response data format

application/json

Response related java object

com.intershop.component.rest.capi.resourceobject.ResourceCollectionRO
com.intershop.sellside.rest.b2c.capi.resourceobject.CategoryRO

Response data example

Anonymous customer: /categories

... 
{
     "name": "Computers",
     "type": "Category",
     ...
     "uri": "inSPIRED-inTRONICS-Site/-/categories/Computers"
 }
...

Anonymous customer: /categories/Computers

 {
    "name": "Computers",
    "type": "Category",
	...
    "subCategoriesCount": 7,
    "subCategories":
    [
        {
            "name": "Monitors",
            "type": "Category",
			...
			"id": "3001",
            "uri": "inSPIRED-inTRONICS-Site/-/categories/Computers/3001"
        },
		...
	]
	...
}

Anonymous customer: /categories;spgid=4E6Q8F1JBYc000TWY3IKC0Nb0000

 ... 
{
     "name": "Computers",
     "type": "Category",
     ...
     "uri": "inSPIRED-inTRONICS-Site/-/categories/Computers"
 }
...

Anonymous customer: /categories;spgid=4E6Q8F1JBYc000TWY3IKC0Nb0000/Computers

  {
    "name": "Computers",
    "type": "Category",
	...
    "subCategoriesCount": 7,
    "subCategories":
    [
        {
            "name": "Monitors",
            "type": "Category",
			...
			"id": "3001",
            "uri": "inSPIRED-inTRONICS-Site/-/categories/Computers/3001"
        },
		...
	]
	...
}

Authenticated customer: /categories

... 
{
     "name": "Computers",
     "type": "Category",
     ...
     "uri": "inSPIRED-inTRONICS-Site/-/categories;spgid=4E6Q8F1JBYc000TWY3IKC0Nb0000/Computers"
 }
...

Authenticated customer: /categories/Computers

 {
    "name": "Computers",
    "type": "Category",
	...
    "subCategoriesCount": 7,
    "subCategories":
    [
        {
            "name": "Monitors",
            "type": "Category",
			...
			"id": "3001",
            "uri": "inSPIRED-inTRONICS-Site/-/categories;spgid=4E6Q8F1JBYc000TWY3IKC0Nb0000/Computers/3001"
        },
		...
	]
	...
}

Authenticated customer: /categories;spgid=4E6Q8F1JBYc000TWY3IKC0Nb0000

... 
{
     "name": "Computers",
     "type": "Category",
     ...
     "uri": "inSPIRED-inTRONICS-Site/-/categories;spgid=4E6Q8F1JBYc000TWY3IKC0Nb0000/Computers"
 }
...

Authenticated customer: /categories;spgid=4E6Q8F1JBYc000TWY3IKC0Nb0000/Computers

 {
    "name": "Computers",
    "type": "Category",
	...
    "subCategoriesCount": 7,
    "subCategories":
    [
        {
            "name": "Monitors",
            "type": "Category",
			...
			"id": "3001",
            "uri": "inSPIRED-inTRONICS-Site/-/categories;spgid=4E6Q8F1JBYc000TWY3IKC0Nb0000/Computers/3001"
        },
		...
	]
	...
}

XML

Request data format

Request related java object

n/a

Request data example

n/a

Response data format

text/xml

Response related java object

com.intershop.component.rest.capi.resourceobject.ResourceCollectionRO
com.intershop.sellside.rest.b2c.capi.resourceobject.CategoryRO

Response data example

Anonymous customer: /categories

... 
    <Category name="Computers" type="Category">
     ...
      <uri>inSPIRED-inTRONICS-Site/-/categories/Computers</uri>
    </Category>
...

Anonymous customer: /categories/Computers

...
<Category name="Computers" type="Category"> 
	...
	<subCategories>
		<Category name="Monitors" type="Category">
      	...
      	<id>3001</id>
	  	<uri>inSPIRED-inTRONICS-Site/-/categories/Computers/3001</uri>
    	</Category>
		...
	</subCategories>
	<subCategoriesCount>7</subCategoriesCount>
</Category>
...

Anonymous customer: /categories;spgid=4E6Q8F1JBYc000TWY3IKC0Nb0000

... 
    <Category name="Computers" type="Category">
     ...
      <uri>inSPIRED-inTRONICS-Site/-/categories/Computers</uri>
    </Category>
...

Anonymous customer: /categories;spgid=4E6Q8F1JBYc000TWY3IKC0Nb0000/Computers

...
<Category name="Computers" type="Category"> 
	...
	<subCategories>
		<Category name="Monitors" type="Category">
      	...
      	<id>3001</id>
	  	<uri>inSPIRED-inTRONICS-Site/-/categories/Computers/3001</uri>
    	</Category>
		...
	</subCategories>
	<subCategoriesCount>7</subCategoriesCount>
</Category>
...

Authenticated customer: /categories

... 
    <Category name="Computers" type="Category">
     ...
      <uri>inSPIRED-inTRONICS-Site/-/categories;spgid=4E6Q8F1JBYc000TWY3IKC0Nb0000/Computers</uri>
    </Category>
...

Authenticated customer: /categories/Computers

...
<Category name="Computers" type="Category"> 
	...
	<subCategories>
		<Category name="Monitors" type="Category">
      	...
      	<id>3001</id>
	  	<uri>inSPIRED-inTRONICS-Site/-/categories;spgid=4E6Q8F1JBYc000TWY3IKC0Nb0000/Computers/3001</uri>
    	</Category>
		...
	</subCategories>
	<subCategoriesCount>7</subCategoriesCount>
</Category>
...

Authenticated customer: /categories;spgid=4E6Q8F1JBYc000TWY3IKC0Nb0000

... 
    <Category name="Computers" type="Category">
     ...
      <uri>inSPIRED-inTRONICS-Site/-/categories;spgid=4E6Q8F1JBYc000TWY3IKC0Nb0000/Computers</uri>
    </Category>
...

Authenticated customer: /categories;spgid=4E6Q8F1JBYc000TWY3IKC0Nb0000/Computers

...
<Category name="Computers" type="Category"> 
	...
	<subCategories>
		<Category name="Monitors" type="Category">
      	...
      	<id>3001</id>
	  	<uri>inSPIRED-inTRONICS-Site/-/categories;spgid=4E6Q8F1JBYc000TWY3IKC0Nb0000/Computers/3001</uri>
    	</Category>
		...
	</subCategories>
	<subCategoriesCount>7</subCategoriesCount>
</Category>
...


Disclaimer

The information provided in the Knowledge Base may not be applicable to all systems and situations. Intershop Communications will not be liable to any party for any direct or indirect damages resulting from the use of the Customer Support section of the Intershop Corporate Web site, including, without limitation, any lost profits, business interruption, loss of programs or other data on your information handling system.

Customer Support
Knowledge Base
Product Resources
Support Tickets