Category
By using this api, you can manage categories of your products.
Models
Category
type Category {
id: ID!
categoryPath: [String!]
categoryPathItems: [CategoryPathItem!]
conditions: [CategoryCondition!]
description: String
imageId: String
isAutomated: Boolean
metaData: HTMLMetaData
name: String!
orderType: CategoryProductsOrderTypeEnum
parentId: String
salesChannelIds: [String!]
salesChannels: [CategorySalesChannel!]
shouldMatchAllConditions: Boolean
translations: [CategoryTranslation!]
}
Fields
categoryPath[String!]It is the id list information where the ids of all the superclasses of the category are found.
categoryPathItems[CategoryPathItem!]It is the id list information where the ids of all the superclasses of the category are found.
conditions[CategoryCondition!]descriptionStringIt is the description of the category of the product.
imageIdStringIt is the id where the picture of the category is kept in the system.
isAutomatedBooleanmetaDataHTMLMetaDataIt is the metadata information of the product category.
It is the name of the category in which the product is located.
orderTypeCategoryProductsOrderTypeEnumparentIdStringIt is the id of the superclass category of the category.
salesChannelIds[String!]It is the information of which sales channel the product category is in.
salesChannels[CategorySalesChannel!]List of hidden sales channels of the category.
shouldMatchAllConditionsBooleantranslations[CategoryTranslation!]It is the translation information of the product category.
CategoryCondition
type CategoryCondition {
conditionType: CategoryConditionTypeEnum!
method: CategoryConditionMethodEnum
valueList: [String!]!
}
Fields
CategoryTranslation
type CategoryTranslation {
description: String
locale: String!
name: String
}
Fields
descriptionStringIt is the description information of the translation.
It is the name information of the translation.
nameStringIt is the information in which language the translation is saved.
Queries
List Categories
Using this api, you can view the categories of products.
Search applies to following fields: name
listCategory(
categoryPath: CategoryPathFilterInput
id: StringFilterInput
name: StringFilterInput
search: String
updatedAt: DateFilterInput
): [Category!]!
Arguments
categoryPathCategoryPathFilterInputYou can filter according to the category path of the product.
You can filter according to the name of the category.
searchStringSome listing APIs have searchable fields. You can search in these fields as you wish. For example, in an API; Let the searchableFields :['name', 'description']. If we send search: AAA as input in args, it will return records with 'AAA' in both the name and description fields.
updatedAtDateFilterInputReturn Type
CategoryCategoryMutations
Save Category
Using this api, you can update the categories of products.
saveCategory(
input: CategoryInput!
): Category!
Arguments
Return Type
CategoryCategoryDelete Category List
Using this api, you can delete the categories of products.
deleteCategoryList(
idList: [String!]!
): Boolean!
Arguments
Return Type
BooleanBooleanThe Boolean scalar type represents true or false.
Examples
Retrieves a list of categories
- BASH
- NODE.JS
curl --location --request POST 'https://api.myikas.com/api/v1/admin/graphql' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <your_access_token>' \
--data-raw '{"query":"{ listCategory { id name } }"}'
const axios = require('axios');
const data = {"query":`{
listCategory {
id
name
}
}
`};
const config = {
method: 'POST',
url: 'https://api.myikas.com/api/v1/admin/graphql',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer your_token'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
if (error.response) {
console.log(JSON.stringify(error.response.data));
}
});
Response
{
"data": {
"listProductAttribute": {
"data": [
{
"id": "a8befae6-2cb9-487a-bd7f-5e0bfff3676b",
"name": "Category name",
"createdAt": 1634019877744
}
]
}
}
}