createProductAttribute
Requires permission products:product:update.
Adds a product attribute, with any first values, before any product carries it. Requires permission to update products.
Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.
Example:
- GraphQL
- cURL
mutation CreateProductAttribute($input: CreateProductAttributeInput!) {
createProductAttribute(input: $input) {
findersNeedingAttention
findersUpdated
variantsUpdated
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "mutation CreateProductAttribute($input: CreateProductAttributeInput!) {\n createProductAttribute(input: $input) {\n findersNeedingAttention\n findersUpdated\n variantsUpdated\n }\n}",
"variables": {
"input": {
"name": "string"
}
}
}
EOF
Variables:
{
"input": {
"name": "string"
}
}
Response:
{
"data": {
"createProductAttribute": {
"findersNeedingAttention": [
"string"
],
"findersUpdated": [
"string"
],
"variantsUpdated": 0
}
}
}
createProductAttribute(
input: CreateProductAttributeInput!
): ProductAttributeChangeResult!
Arguments
createProductAttribute.input ● CreateProductAttributeInput! non-null input
The new attribute.
Type
ProductAttributeChangeResult object
What an attribute change did.