Product Attribute
By using this api, you can manage attributes of your products.
Models
ProductAttribute
type ProductAttribute {
id: ID!
description: String
name: String!
options: [ProductAttributeOption!]
tableTemplate: ProductAttributeTableTemplate
translations: [ProductAttributeTranslation!]
type: ProductAttributeTypeEnum!
}
Fields
descriptionStringDescription of the attribute
Name of the attribute
options[ProductAttributeOption!]Options of the attribute
tableTemplateProductAttributeTableTemplateTable template description for product attribute
translations[ProductAttributeTranslation!]Translations for the attribute
Type of the attribute
ProductAttributeOption
type ProductAttributeOption {
id: ID!
name: String!
}
Fields
Name of the product attribute option
ProductAttributeValue
type ProductAttributeValue {
imageIds: [String!]
productAttributeId: String
productAttributeOptionId: String
value: String
}
Fields
imageIds[String!]Image ids of the product attribute
productAttributeIdStringIdentifier of the product attribute
productAttributeOptionIdStringOption identifier for the product attribute
valueStringValue of the product attribute
ProductAttributeTranslation
type ProductAttributeTranslation {
description: String
locale: String!
name: String
options: [ProductAttributeOptionTranslation!]
}
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.
List of translations for attribute options
Queries
List Product Attributes
Use this query to list product attributes.
listProductAttribute(
id: StringFilterInput
name: StringFilterInput
updatedAt: DateFilterInput
): [ProductAttribute!]!
Arguments
updatedAtDateFilterInputReturn Type
ProductAttributeProductAttributeMutations
Save Product Attribute
Use this mutation to create or update product attributes with provided input values.
saveProductAttribute(
input: ProductAttributeInput!
): ProductAttribute!
Arguments
Return Type
ProductAttributeProductAttributeDelete Product Attribute List
Use this mutation to delete product attributes with specific ids.
deleteProductAttributeList(
idList: [String!]!
): Boolean!
Arguments
Return Type
BooleanBooleanThe Boolean scalar type represents true or false.
Examples
Retrieves a list of product attributes
- 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":"{ listProductAttribute { id name createdAt } }"}'
const axios = require('axios');
const data = {"query":`{
listProductAttribute {
id
name
createdAt
}
}
`};
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": [
{
"id": "a8befae6-2cb9-487a-bd7f-5e0bfff3676b",
"name": "Product attribute name",
"createdAt": 1634019877744
}
]
}
}