A category nests under a parent, and its descriptions give it a name and a URL per language, which the URLs of its products follow. Like a product, a category is not versioned but its descriptions are.
Categories
Product categories, which file products and give them their URL, and their descriptions.
About categories
List product categories#
GET
/cdna-api/products/categories
Lists product categories. Without limit every match comes back.
- Access
- Admin users and integrations, with an OAuth access token or an API key.
- Model
- Category, in the Reference
Parameters
propertiesquery- selector
- The fields and relations to return, such as
{id,name,slug,fullPath,published}. filtersquery- name=value
- Any stored field, or a relation with a dot, such as
parent.id=12. Prefix the name with!,>,<,%or|. Use stored field names exactly as in the model, and comparetotalCountwith the unfiltered list's to confirm a filter applied. orderByquery- string
field:ASCorfield:DESC, comma-separated. Stored fields only.limitquery- integer
- Records per response. There is no default.
offsetquery- integer
- Records to skip.
Example
List product categories
GET /cdna-api/products/categories?limit=2&properties={id,name,slug,fullPath,published} HTTP/1.1
Host: hub.coredna.com
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json
Response
200 OK
{
"result": "success",
"totalCount": 1,
"data": [
{
"id": 3,
"name": "API sandbox",
"slug": "api-sandbox",
"fullPath": "/products/category/api-sandbox",
"published": null
}
]
}
Open in Postman docs Real response from this documentation site
Show a product category#
GET
/cdna-api/products/category/{id}
Reads one product category by its id.
- Access
- Admin users and integrations, with an OAuth access token or an API key.
- Model
- Category, in the Reference
Parameters
idpathrequired- integer
- The product category id.
propertiesquery- selector
- The fields and relations to return, such as
{id,name,slug,fullPath,published}.
Example
Show a product category
GET /cdna-api/products/category/3?properties={id,name,slug,fullPath,published} HTTP/1.1
Host: hub.coredna.com
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json
Response
200 OK
{
"result": "success",
"data": {
"id": 3,
"name": "API sandbox",
"slug": "api-sandbox",
"fullPath": "/products/category/api-sandbox",
"published": null
}
}
Open in Postman docs Real response from this documentation site
Create a product category#
POST
/cdna-api/products/category
Creates a product category.
- Access
- Admin users and integrations, with an OAuth access token or an API key.
- Returns
- The new category, in the fields
propertiesasks for, and amessage.
Parameters
descriptionsbodyrequired- list
- The content per language: each with
language,nameandslug. At least one. parentbody- integer
- The parent category, by id.
publishedbody- datetime
truepublishes now. A new category is unpublished.
Example
Create a product category
POST /cdna-api/products/category?properties={id,name,slug,position,published} HTTP/1.1
Host: hub.coredna.com
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json
Content-Type: application/json
{
"descriptions": [
{ "language": 47, "name": "API sandbox", "slug": "api-sandbox" }
]
}
Response
200 OK
{
"result": "success",
"data": {
"id": 3,
"name": "API sandbox",
"slug": "api-sandbox",
"position": 1,
"published": null
},
"message": "The Category has been added successfully."
}
Open in Postman docs Real response from this documentation site
Edit a product category#
PUT
/cdna-api/products/category/{id}
Changes a product category. Fields left out keep their values.
- Access
- Admin users and integrations, with an OAuth access token or an API key.
- Returns
- The saved category under
data.category, and amessage.
Parameters
idpathrequired- integer
- The category id.
parentbody- integer
- The parent category, by id;
nullmakes it top level. descriptionsbody- list
- The descriptions; one with an
idchanges it.
Example
Edit a product category
PUT /cdna-api/products/category/9 HTTP/1.1
Host: hub.coredna.com
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json
Content-Type: application/json
{
"parent": 3
}Delete a product category#
DELETE
/cdna-api/products/category/{id}
Deletes a product category.
- Access
- Admin users and integrations, with an OAuth access token or an API key.
Parameters
idpathrequired- integer
- The product category id.
Example
Delete a product category
DELETE /cdna-api/products/category/9 HTTP/1.1
Host: hub.coredna.com
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/jsonDuplicate a product category#
POST
/cdna-api/products/duplicate-category/{id}
Copies a category and saves the copy, whose name starts with “Copy of”.
- Access
- Admin users and integrations, with an OAuth access token or an API key.
- Returns
- The copy under
data.category, and amessage.
Parameters
idpathrequired- integer
- The product category id.
Example
Duplicate a product category
POST /cdna-api/products/duplicate-category/9 HTTP/1.1
Host: hub.coredna.com
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json