Attribute GraphQL Operations
Table of Contents
Overview
This document provides an overview of the GraphQL API for managing attributes and attribute values. It includes the available queries and mutations, as well as the types used in the API.
Schemas
Query
attributes
Fetches attributes.
Returns:
[AttributeType] - An array of attribute types.
Example:
query {
attributes {
id
name
category
options
active
relatedAttributes
required
active
defaultValue
description
}
}
attributeValues
Fetches all attribute values for a given project and type.
Arguments:
projectId: String!
- The unique identifier of the project. Requiredtype: String!
- Type of the attribute value. It can be only “project” | “component” |“version” Required
Returns:
[AttributeValue] - An array of attribute values.
Example:
query {
attributeValues(projectId: "10000", type: "component") {
projectId
componentId
versionId
attributeTypeId
stringValue
integerValue
floatValue
}
}
attributeValuesByAttributeId
Fetches all attribute values for a given project and attribute ID.
Arguments:
projectId: String!
- The unique identifier of the project. RequiredattributeId: String!
- The unique identifier of the attribute Required
Returns:
[AttributeValue] - An array of attribute values.
Example:
query {
attributeValues(projectId: "10000", type: "attributeType-1234-5678") {
projectId
componentId
versionId
attributeTypeId
stringValue
integerValue
floatValue
}
}
attributeValuesByCategory
Fetches all attribute values for a given project and category.
Arguments:
projectId: String!
- The unique identifier of the project. Requiredcategory:
AttributeCategory - One of the category of attribute type Required
Returns:
[AttributeValue] - An array of attribute values.
Example:
attributeValuesByName
Fetches all attribute values for a given project and attribute type name.
Arguments:
projectId: String!
- The unique identifier of the project. Requiredname: String!
- Name of the attribute type Required
Returns:
[AttributeValue] - An array of attribute values.
Example:
Mutation
saveAttribute
Saves a new attribute or updates an existing one.
Arguments:
attribute:
AttributeTypeInput! - The input data for the attribute. Required
Returns:
AttributeType - The saved or updated attribute.
Example:
saveAttributeValues
Save attribute value for given component, version or project
Arguments:
attributeValues:
[AttributeValueInput] - An array of attribute values.RequiredprojectId: String!
- The ID of the project. Requiredtype: String!
- Type of the attribute value. It can be only “project” | “component” | “version”Required
Returns:
[AttributeValue] - The updated attribute values.
Example:
deleteAttribute
Deletes a specific attribute by its ID.
Arguments:
id: String!
- The unique identifier of the attribute type. Required
Returns:
String!
- A message indicating the result of the deletion.
Example:
deleteAttributeValue
Deletes a specific attribute value by its ID.
Arguments:
id: String!
- The unique identifier of the attribute value. Required
Returns:
String!
- A message indicating the result of the deletion.
Example:
String!
- A message indicating the result of the deletion.
Types
AttributeType
Represents a attribute.
Fields:
id: String!
- The unique identifier of the attribute type.name: String!
- The name of the attribute.category: String!
- The category of the attribute type. (SINGLE_SELECT, DURATION etc.)description: String
- A description of the attribute type.active: Boolean!
- Indicates if the attribute type is active.required: Boolean!
- Indicates if the attribute type is required.options: [String]
- Indicates if the attribute type is single select and has options.relatedAttributes: [String]!
- The related types included in the attribute. (Project, component or version)
AttributeCategory
Represents the category of an attribute.
Fields:
BOOLEAN
- Represents a boolean attribute type.DURATION
- Represents a duration attribute type.TEXT
- Represents a text attribute type.INTEGER
- Represents a integer attribute type.DECIMAL
- Represents a decimal attribute type.SINGLE_SELECT
- Represents a single select attribute type.
AttributeTypeInput
Input type for saving attribute.
Fields:
id: String
- The unique identifier of the attribute type.name: String!
- The name of the attribute.category: String!
- The category of the attribute type. (SINGLE_SELECT, DURATION etc.)description: String
- A description of the attribute type.active: Boolean!
- Indicates if the attribute type is active.required: Boolean!
- Indicates if the attribute type is required.options: [String]
- Indicates if the attribute type is single select and has options.relatedAttributes: [String]!
- The related types included in the attribute. (Project, component or version)
AttributeValue
Represents a attribute value.
Fields:
projectId: String!
- The unique identifier of the project.componentId: String
- The unique id of component if type is component.versionId: String
- The unique id of the version if type is version.attributeTypeId: String!
- The unique id of the attribute type.stringValue: String
- Indicates string value of attribute valueintegerValue: Int
- Indicates string value of attribute value if attribute type is duration or integer.floatValue: Float
- Indicates string value of attribute value if attribute type is decimal.
AttributeValueInput
Input type for saving attribute value.
Fields:
projectId: String!
- The unique identifier of the project.componentId: String
- The unique id of component if type is component.versionId: String
- The unique id of the version if type is version.attributeTypeId: String!
- The unique id of the attribute type.stringValue: String
- Indicates string value of attribute valueintegerValue: Int
- Indicates string value of attribute value if attribute type is duration or integer.floatValue: Float
- Indicates string value of attribute value if attribute type is decimal.