categories

categories.find

Returns a list of categories.

JS
CR.api('commerce.categories.find', request, function(response) { … });
HTTP
POST /open2b/api/v3/commerce.categories.find

request

{
  "language" : "en", // language ( ISO code ) of the texts to return - string(2)
  "fields" : [ "id", "code", "name" ], // fields to return - string
  "order" : [ "name" ], // sort order of returned categories, can contain "id", "-id", "code", "-code", "name" and "-name" - string
  "limit" : 2, // maximum number of categories to return - int(1…100)
  "first" : 30 // index of the first category to return - int(0…)
}

response

{
  "status" : "ok",
  "categories" : [ {
    "id" : 496, // identifier - int(1…)
    "code" : "SHIRTS", // code - string(0…32)
    "name" : { // name - string(0…60)
      "en" : "Shirts",
      "it" : "Camicie"
    }
  }, … ]
}

categories.get

Returns a category given its identifier.

JS
CR.api('commerce.categories.get', request, function(response) { … });
HTTP
POST /open2b/api/v3/commerce.categories.get

request

{
  "id" : 496, // identifier of the category (required) - int(1…)
  "language" : "en", // language ( ISO code ) of the texts to return - string(2)
  "fields" : [ "id", "code", "name" ] // fields to return - string
}

response

{
  "status" : "ok",
  "category" : { // (can be null)
    "id" : 496, // identifier - int(1…)
    "code" : "SHIRTS", // code - string(0…32)
    "name" : { // name - string(0…60)
      "en" : "Shirts",
      "it" : "Camicie"
    }
  }
}

categories.count

Total number of categories.

JS
CR.api('commerce.categories.count', null, function(response) { … });
HTTP
POST /open2b/api/v3/commerce.categories.count

response

{
  "status" : "ok",
  "count" : 23 // number of categories - int(0…)
}

categories.create

Creates a new category.

JS
CR.api('commerce.categories.create', request, function(response) { … });
HTTP
POST /open2b/api/v3/commerce.categories.create

request

{
  "category" : { // category to create (required)
    "code" : "SHIRTS", // code - string(0…32)
    "name" : { // name - string(0…60)
      "en" : "Shirts",
      "it" : "Magliette"
    }
  }
}

response

{
  "status" : "ok",
  "id" : 496 // identifier of the new category - int(1…)
}

categories.update

Updates a category. Any fields left out of the request will remain unchanged.

JS
CR.api('commerce.categories.update', request, function(response) { … });
HTTP
POST /open2b/api/v3/commerce.categories.update

request

{
  "id" : 496, // identifier of the category to update (required) - int(1…)
  "category" : { // category's fields to update (required)
    "code" : "NEW SHIRTS", // code - string(0…32)
    "name" : { // name - string(0…60)
      "en" : "Shirts",
      "it" : "Camicie"
    }
  }
}

response

{
  "status" : "ok"
}

Errors

Field Type Description
id NotFound Category <id> does not exist

categories.delete

Deletes one or more categories.

JS
CR.api('commerce.categories.delete', request, function(response) { … });
HTTP
POST /open2b/api/v3/commerce.categories.delete

request


{
  "ids" : [ 351, 78, 109, … ] // identifiers of the categories to delete (required) - int(1…)
}

response


{
  "status" : "ok"
}