Skip to main content

Category

Use the REST API to interact with the categories in the application.

You should take into account when making your request
info

Remember that for some requests, you need to send the authentication token.

Header Parameters

{
"Authorization": "Bearer ...token..."
}

And the query parameters are as follows:

Query Parameters

{
"setting": {
"timezone": "America/Bogota",
"fromAdmin": true,
"appMode": "iadmin",
"authProvider": "local",
"locale": "en"
}
}
Do you want to see the changes made through the API?
info

After using the API to access products, it's important to update the cache to see the changes.

How to do it:

  • Go to the upper-right corner and select the dropdown menu with your username.
  • Click on 'Settings.'
  • In the 'Actions' section, look for the 'Clear Cache' option.
  • Click on 'Clear Cache' to update the information and view the updated products.

Clear cache

Create a Category

Use this endpoint to create a category.

POST/api/icommerce/v3/categories
{
"attributes": {
"es": { // This depends on the server's language
"title": "Test",
"slug": "test",
"description": "Descripción" // You can use HTML for this field
}
}
}
Response
{
"data": {
"id": 10,
"title": "Testeando",
"h1Title": "",
"slug": "testeando",
"url": "...",
"newUrl": "...",
"description": "Descripción",
"parentId": 0,
"sortOrder": "0",
"metaTitle": "Testeando",
"metaDescription": "Descripción",
"options": null,
"createdAt": "2023-10-23 11:01:22",
"updatedAt": "2023-10-23 11:01:22",
"parent": null,
"children": [],
"status": "0",
"mediaFiles": {
"mainimage": {
"id": null,
"filename": null,
"mimeType": null,
"fileSize": null,
"path": "...",
"relativePath": "...",
"isImage": true,
"isVideo": false,
"isFolder": false",
...
},
"secondaryimage": {
"id": null,
"filename": null,
"mimeType": null,
"fileSize": null,
"path": "...",
"relativePath": "...",
"isImage": true,
"isVideo": false,
"isFolder": false",
...
},
"quaternaryimage": {
"id": null,
"filename": null,
"mimeType": null,
"fileSize": null,
"path": "...",
"relativePath": "...",
"isImage": true,
"isVideo": false,
"isFolder": false",
...
},
"iconimage": {
"id": null,
"filename": null,
"mimeType": null,
"fileSize": null,
"path": "...",
"relativePath": "...",
"isImage": true,
"isVideo": false,
"isFolder": false",
...
},
"bannerindeximage": {
"id": null,
"filename": null,
"mimeType": null,
"fileSize": null,
"path": "...",
"relativePath": "...",
"isImage": true,
"isVideo": false,
"isFolder": false",
...
},
"carouselindeximage": [],
"carouseltopindeximages": []
},
"layoutId": null
}
}

Modify a Category

Use this endpoint to modify a category. You can send one or more values in the request.

By default, the accepted value is the ID. If you want to send another value, you must include the following in the Query Parameters:

{
"filter": {
"field": "title" // The value by which the search will be performed
}
}
PUT/api/icommerce/v3/categories/{criteria}
{
"attributes": {
"es": {
"title": "fix name",
}
}
}
Response
{
"data": "Item Updated"
}

Get Multiple Categories

Use this endpoint to retrieve multiple categories.

You can filter and paginate the categories. The data that can be included are:

IncludeDescription
parentInclude the parent of the category

Query Parameters:

GET/api/icommerce/v3/categories
{
"filter": {
"order": {
"field":"created_at",
"way":"desc"
}
},
"page": 1, //Numero de pagina de categorías
"take": 1, //Categorías tomadas
"include": 'parent'
}
Response
{
"data": [
{
"id": 2,
"title": "Testeando",
"h1Title": "",
"slug": "testeando",
"url": "",
"newUrl": "",
"description": "Descripción",
"parentId": 0,
"showMenu": false,
"featured": false,
"sortOrder": "0",
"metaTitle": "Testeando",
"metaDescription": "Descripción",
"options": null,
"createdAt": "2023-10-23 11:01:22",
"updatedAt": "2023-10-23 11:01:22",
"parent": {
"id": 1,
"title": "Categoria padre",
"h1Title": "",
"slug": "categoria-padre",
"url": "",
"newUrl": "",
"description": "padre",
"parentId": 0,
"showMenu": false,
"featured": true,
"sortOrder": "0",
"metaTitle": "Categoria padre",
"metaDescription": "Esta es una Categoria padre",
"options": {
"masterRecord": "0",
"view": "1",
"descriptionIndex": null
},
"createdAt": "2023-09-21 09:01:36",
"updatedAt": "2023-09-21 09:01:36",
"status": "1",
"mediaFiles": {...},
"layoutId": null
},
"status": "1",
"mediaFiles": {
"mainimage": {
"id": null,
"filename": null,
"mimeType": null,
"fileSize": null,
"path": "...",
"relativePath": "....",
"isImage": true,
"isVideo": false,
"isFolder": false,
"mediaType": false,
"folderId": null,
"description": null,
"alt": null,
"keywords": null,
"createdBy": null,
"createdAt": null,
"updatedAt": null,
"faIcon": "fa-file",
"disk": null,
"extension": null,
"url": "....",
"createdByUser": null,
"tags": [],
"thumbnails": [
{
"name": "smallThumb",
"path": "...",
"size": "300x"
},
{
"name": "mediumThumb",
"path": "...",
"size": "600x"
},
{
"name": "largeThumb",
"path": "...",
"size": "900x"
},
{
"name": "extraLargeThumb",
"path": "...",
"size": "1920x"
}
],
"smallThumb": "...",
"relativeSmallThumb": "...",
"mediumThumb": "...",
"relativeMediumThumb": "...",
"largeThumb": "...",
"relativeLargeThumb": "...",
"extraLargeThumb": "...",
"relativeExtraLargeThumb": "..."
},
"secondaryimage": { "id": null },
"quaternaryimage": { "id": null },
"iconimage": { "id": null },
"bannerindeximage": { "id": null },
"carouselindeximage": [],
"carouseltopindeximages": []
},
"layoutId": null
}
],
"meta": {
"page": {
"total": 10,
"lastPage": 10,
"perPage": "1",
"currentPage": 1
}
}
}

Get a Category

Use this endpoint to retrieve a specific category.

GET/api/icommerce/v3/categories/{criteria}
{}
Response
{
"data": {
"id": 2,
"title": "Testeando",
"h1Title": "",
"slug": "testeando",
"url": "",
"newUrl": "",
"description": "Descripción",
"parentId": 0,
"showMenu": false,
"featured": false,
"sortOrder": "0",
"metaTitle": "Testeando",
"metaDescription": "Descripción",
"options": null,
"createdAt": "2023-10-23 11:01:22",
"updatedAt": "2023-10-23 11:01:22",
"parentId": 1,
"status": "1",
"mediaFiles": {
"mainimage": {
"id": null,
"filename": null,
"mimeType": null,
"fileSize": null,
"path": "...",
"relativePath": "....",
"isImage": true,
"isVideo": false,
"isFolder": false,
"mediaType": false,
"folderId": null,
"description": null,
"alt": null,
"keywords": null,
"createdBy": null,
"createdAt": null,
"updatedAt": null,
"faIcon": "fa-file",
"disk": null,
"extension": null,
"url": "....",
"createdByUser": null,
"tags": [],
"thumbnails": [
{
"name": "smallThumb",
"path": "...",
"size": "300x"
},
{
"name": "mediumThumb",
"path": "...",
"size": "600x"
},
{
"name": "largeThumb",
"path": "...",
"size": "900x"
},
{
"name": "extraLargeThumb",
"path": "...",
"size": "1920x"
}
],
"smallThumb": "...",
"relativeSmallThumb": "...",
"mediumThumb": "...",
"relativeMediumThumb": "...",
"largeThumb": "...",
"relativeLargeThumb": "...",
"extraLargeThumb": "...",
"relativeExtraLargeThumb": "..."
},
"secondaryimage": { "id": null },
"quaternaryimage": { "id": null },
"iconimage": { "id": null },
"bannerindeximage": { "id": null },
"carouselindeximage": [],
"carouseltopindeximages": []
},
"layoutId": null
}
}

Delete a Category

Use this endpoint to delete a specific category.

Send the category's ID to delete it.

DELETE/api/icommerce/v3/categories/{id}
{}
Response
{
"data": "Request successful"
}

Category Fields

titleType:
Text
Description:

Category title.

h1_titleType:
Varchar
Description:

Category H1 title.

Maximum of 191 characters.
slugType:
Varchar
Description:

Category's friendly URL or slug.

Maximum of 191 characters.
descriptionType:
Text
Description:

Detailed description of the category.

meta_titleType:
Text
Description:

Meta title for the category.

meta_descriptionType:
Text
Description:

Meta description for the category.

parent_idType:
Integer
Description:

Identification of the parent category it belongs to.

show_menuType:
Boolean
Description:

Indicates whether the category should be shown in the menu (true/false).

featuredType:
Boolean
Description:

Indicates if the category is featured (true/false).

store_idType:
Integer
Description:

Identification of the store associated with the category.

statusType:
Varchar
Description:

Category status.

sort_orderType:
Integer
Description:

Order of category in a list or catalog.

external_idType:
Integer
Description:

External identification of the category.