Skip to main content

Retrieve

This chapter describes common query patterns for retrieving Construction Kit metadata. The Construction Kit API is read-only - you query the model structure but cannot modify it through GraphQL.

Query Structure

All Construction Kit queries use the constructionKit root field:

query {
constructionKit {
models { ... }
types { ... }
attributes { ... }
enums { ... }
records { ... }
associationRoles { ... }
}
}

Common Query Parameters

All Construction Kit queries support these parameters:

Pagination

Use first and after for cursor-based pagination:

query {
constructionKit {
types(first: 10, after: "YXJyYXljb25uZWN0aW9uOjk=") {
totalCount
pageInfo {
endCursor
hasNextPage
hasPreviousPage
startCursor
}
items {
ckTypeId {
fullName
}
}
}
}
}

Filter by ID

Use ckId to retrieve a specific item:

query {
constructionKit {
types(ckId: "Industry.Energy-1.0.0/EnergyMeter-1") {
items {
ckTypeId {
fullName
semanticVersionedFullName
}
description
isAbstract
isFinal
}
}
}
}

Filter by Model

Use ckModelIds to filter by one or more models:

query {
constructionKit {
types(ckModelIds: ["Industry.Energy-1", "Basic-1"]) {
totalCount
items {
ckTypeId {
fullName
}
}
}
}
}

Field Filters

Use fieldFilter for attribute-based filtering:

query {
constructionKit {
models(
fieldFilter: [
{ attributePath: "modelState", operator: EQUALS, comparisonValue: "AVAILABLE" }
]
) {
items {
id {
fullName
}
modelState
}
}
}
}

Search Filter

Use searchFilter for text search:

query {
constructionKit {
types(
searchFilter: {
searchTerm: "Energy"
type: ATTRIBUTE_FILTER
attributePaths: ["ckTypeId"]
}
) {
items {
ckTypeId {
fullName
}
}
}
}
}

Sort Order

Use sortOrder to define the result ordering:

query {
constructionKit {
types(
sortOrder: [
{ attributePath: "ckTypeId", sortOrder: ASCENDING }
]
) {
items {
ckTypeId {
fullName
}
}
}
}
}

Response Structure

All queries return a connection type with:

FieldDescription
totalCountTotal number of matching items
pageInfoPagination cursors and flags
itemsArray of result items

PageInfo

FieldTypeDescription
endCursorStringCursor of the last item in the result
hasNextPageBooleanWhether more items exist after this page
hasPreviousPageBooleanWhether items exist before this page
startCursorStringCursor of the first item in the result

Component Queries

For detailed documentation on querying specific components:

ComponentDocumentation
ModelsModels
TypesTypes
AttributesAttributes
EnumsEnums
RecordsRecords
Association RolesAssociation Roles