Category
Use the REST API to interact with the categories in the application.
You should take into account when making your request
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?
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.
Create a Category
Use this endpoint to create a category.
- Minimum
- Rest
{
"attributes": {
"es": { // This depends on the server's language
"title": "Test",
"slug": "test",
"description": "Descripción" // You can use HTML for this field
}
}
}
{
"attributes": {
"user_id": 2,
"status": "1",
"parent_id": "0",
"show_menu": false,
"featured": "0",
"sort_order": "0",
"medias_single": {},
"medias_multi": {},
"layout_id": null,
"es": {
"title": "categorías",
"slug": "categorias",
"description": "testeans",
"h1_title": "",
"meta_title": "",
"meta_description": ""
}
}
}
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
}
}
- Minimum
- Rest
{
"attributes": {
"es": {
"title": "fix name",
}
}
}
{
"attributes": {
"user_id": 2,
"status": "1",
"parent_id": "0",
"show_menu": false,
"featured": "0",
"sort_order": "0",
"medias_single": {},
"medias_multi": {},
"layout_id": null,
"es": {
"title": "categorías",
"slug": "categorias",
"description": "testeans",
"h1_title": "",
"meta_title": "",
"meta_description": ""
}
}
}
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:
Include | Description |
---|---|
parent | Include the parent of the category |
Query Parameters
:
- Rest
{
"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.
- Rest
{}
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.
- Rest
{}
Response
{
"data": "Request successful"
}
Category Fields
title | Type:Text Description: Category title. |
h1_title | Type:Varchar Description: Category H1 title. Maximum of 191 characters. |
slug | Type:Varchar Description: Category's friendly URL or slug. Maximum of 191 characters. |
description | Type:Text Description: Detailed description of the category. |
meta_title | Type:Text Description: Meta title for the category. |
meta_description | Type:Text Description: Meta description for the category. |
parent_id | Type:Integer Description: Identification of the parent category it belongs to. |
show_menu | Type:Boolean Description: Indicates whether the category should be shown in the menu (true/false). |
featured | Type:Boolean Description: Indicates if the category is featured (true/false). |
store_id | Type:Integer Description: Identification of the store associated with the category. |
status | Type:Varchar Description: Category status. |
sort_order | Type:Integer Description: Order of category in a list or catalog. |
external_id | Type:Integer Description: External identification of the category. |