Categories
(ms.categories)

Contains all the categories that are required for a specific site. Existing categories can be edited, deleted or duplicated or a new category can be added by clicking on add new button.

Fields

name
Type: string

Required: Yes
Name of the category
alias
Type: string
Alias of the category's name
description
Type: string
Brief description about the category
image
Type: file
Single image related to the category
images
Type: array
Multiple images related to the category
fields
Type: array

Required: No
parent
Type: string
Parent category (if any) of the category
count
Type: string

Required: No
Number of products saved under the category
SEO
Type: object
Contains SEO variables like title, description, keywords, canonical url and sitemap priority
metafield_sets
Type: array
Meta fields to be used in case extend entity is used
publish
Type: string
Flag that determines if a category is published i.e. visible to users
attributes
Type: array
default_sort_order
Type: string
Order by which a category's children will be sorted
List GET /api/1/entity/ms.categories

List the records saved in the entity.

Example

Listing categories of a store
GET /api/1/entity/ms.categories

Example Response Json

[
    {
      "_id": "54bf43c18624dfe65f6b3a45",
      "fields": [],
      "SEO": {},
      "publish": "1",
      "description": "",
      "name": "CATEGORY4",
      "alias": "category4",
      "created_on": "2015-01-21T06:14:25.590Z",
      "_created_by": "54bf433d8624dfe65f6b3a44",
      "sort_order": 4,
      "parent": null,
      "count": 2,
      "default_sort_order": "manually",
      "children": [],
      "level": 1
    },
    {
      "_id": "54bf43cd8624dfe65f6b3a46",
      "fields": [],
      "SEO": {},
      "publish": "1",
      "description": "",
      "name": "CATEGORY5",
      "alias": "category5",
      "created_on": "2015-01-21T06:14:37.989Z",
      "_created_by": "54bf433d8624dfe65f6b3a44",
      "sort_order": 5,
      "parent": null,
      "count": 2,
      "default_sort_order": "manually",
      "children": [],
      "level": 1
    }
  ]

Message

Code Message
ms.entity.categories.list
Add POST /api/1/entity/ms.categories

Add the record in the entity.

Example

Adding a category
POST /api/1/entity/ms.categories

Example Request Json

{
  "SEO": {},
  "alias": "test-category",
  "default_sort_order": "-created_on",
  "description": "test category",
  "images": [],
  "name": "test category",
  "publish": 1
}

Example Response Json

{"_id":"586a45e4903dfc20432f107f"}

Message

Code Message
ms.entity.categories.add
Update PUT /api/1/entity/ms.categories/:id

Update the record in the entity.

Example

Editing a category
PUT /api/1/entity/ms.categories/586a45e4903dfc20432f107f

Example Request Json

{
      "description": "test category description",
    }

Message

Code Message
ms.entity.categories.edit updated successfully
Delete DELETE /api/1/entity/ms.categories/:id

Delete the record from the entity.

Example

Deleting a category
DELETE /api/1/entity/ms.categories/586a45e4903dfc20432f107f

Message

Code Message
ms.entity.categories.delete updated successfully
Get GET /api/1/entity/ms.categories/:id

Get the record from the entity.

Example

Getting a category
GET /api/1/entity/ms.categories/54bf43c18624dfe65f6b3a45

Example Response Json

{
  "_id": "54bf43c18624dfe65f6b3a45",
  "fields": [],
  "SEO": {},
  "publish": "1",
  "description": "",
  "name": "CATEGORY4",
  "alias": "category4",
  "created_on": "2015-01-21T06:14:25.590Z",
  "_created_by": "54bf433d8624dfe65f6b3a44",
  "sort_order": 4,
  "parent": null,
  "count": 2,
  "default_sort_order": "manually"
}

Message

Code Message
ms.entity.categories.get
Duplicate POST /api/1/entity/ms.categories/:id/_duplicate

Duplicate the record from the entity.

Example

Duplicating a category
POST /api/1/entity/ms.categories/51fb787e4cfe31ad2a000001/_duplicate

Example Request Json

{
  "name": "Duplicate category",
  "parent": "586a4a52903dfc20432f10f4"
}

Example Response Json

{"_id":"586a4a71903dfc20432f10f7"}

Message

Code Message
ms.entity.categories.duplicate
StartImport POST /api/1/entity/_/ms.categories/startImport

Imports categories into the entity from an uploaded csv file

Example

Importing categories from csv file
POST /api/1/entity/_/ms.categories/startImport

Example Request Json

{
  "entity": "ms.categories",
  "file": {
    "_id": "586a4c0cb406fe4d0819a0af",
    "name": "export.csv",
    "path": "tmp/586a4c0cb406fe4d0819a0ae/export.csv",
    "size": 1339,
    "tmp_path": "/tmp/bc35996d5630e77ae801e2abaa3bc8b5",
    "type": "text/csv",
    "uploadType": "tmp",
    "file_name": "export.csv",
    "status": "uploaded",
    "uploaded_by": "user@hippoinnovations.com"
  }
}

Message

Code Message
ms.entity.categories.startImport
GetCategoryDetail GET POST /api/1/entity/ms.categories/getCategoryDetail

This command provides the details of a particular category in an heirarchical manner that reflects parent-child relationships between that category and other categories

Example

Getting details of a category
GET POST /api/1/entity/ms.categories/getCategoryDetail

Example Response Json

{
  "_id": "586fa0afd97b964854631485",
  "name": "test category",
  "parent": {
    "_id": "586fa0aed97b964854631481",
    "name": "test parent",
    "parent": {
      "_id": "586fa0add97b96485463147d",
      "name": "test grandparent",
      "images": [],
      "fields": [],
      "SEO": {},
      "publish": "1",
      "default_sort_order": "-created_on",
      "alias": "test-grandparent",
      "sort_order": 0,
      "created_on": "2017-01-06T13:50:37.565Z"
    },
    "images": [],
    "fields": [],
    "SEO": {},
    "publish": "1",
    "default_sort_order": "-created_on",
    "alias": "test-parent",
    "sort_order": 0,
    "created_on": "2017-01-06T13:50:38.822Z"
  },
  "images": [],
  "fields": [],
  "SEO": {},
  "publish": "1",
  "default_sort_order": "-created_on",
  "alias": "test-category",
  "sort_order": 0,
  "created_on": "2017-01-06T13:50:40.053Z"
}

Message

Code Message
ms.entity.categories.getCategoryDetail

Query Parameters

Code Message
alias Alias of the category for which you want to fetch the details