JetEngine
Examples of queries to interact with data from Crocoblock's JetEngine plugin.
For the full API (root fields, JetEngineCCTEntry type, filter/pagination/sort, field casts), see the JetEngine CCT extension reference.
List CCT entries
Query all entries for a CCT by providing its slug. You can request entry properties and CCT field values via fieldValues or fieldValue(slug:).
query JetEngineCCTEntries($cctSlug: String!) {
jetengineCCTEntryCount(cctSlug: $cctSlug)
jetengineCCTEntries(cctSlug: $cctSlug) {
id
cctSlug
status
authorID
author {
id
name
}
singleCustomPostID
singleCustomPost {
id
title
customPostType
}
createdDate
createdDateStr
modifiedDate
modifiedDateStr
fieldValues
label_text: fieldValue(slug: "label_text")
textarea: fieldValue(slug: "textarea")
number: fieldValue(slug: "number")
switcher: fieldValue(slug: "switcher")
gallery: fieldValue(slug: "gallery")
}
}Single CCT entry
Fetch one CCT entry by CCT slug and the entry's numeric ID.
query JetEngineCCTEntry($cctSlug: String!, $id: ID!) {
jetengineCCTEntry(cctSlug: $cctSlug, by: { id: $id }) {
id
uniqueID
cctSlug
status
authorID
author {
id
name
}
singleCustomPostID
singleCustomPost {
id
title
customPostType
}
createdDate
createdDateStr
modifiedDate
modifiedDateStr
fieldValues
label_text: fieldValue(slug: "label_text")
textarea: fieldValue(slug: "textarea")
repeater: fieldValue(slug: "repeater")
}
}Entry fields and dates
Each entry exposes implicit fields (id, authorID, singleCustomPostID, dates, etc.) and CCT field values. Use createdDateStr / modifiedDateStr with an optional format for formatted date strings.
query JetEngineCCTEntryFields {
jetengineCCTEntry(cctSlug: "sample_cct", by: { id: 1 }) {
id
uniqueID
cctSlug
status
singleCustomPostID
singleCustomPost {
id
title
customPostType
}
authorID
author {
id
name
}
createdDate
createdDateStr
formattedCreatedDateStr: createdDateStr(format: "d/m/Y")
modifiedDate
modifiedDateStr
formattedModifiedDateStr: modifiedDateStr(format: "d/m/Y")
fieldValues
label_text: fieldValue(slug: "label_text")
number: fieldValue(slug: "number")
}
}Filter CCT entries
List and count support a filter argument: filter by ids or by search (field, value, operator). Operators include EQUALS (default) and LIKE.
query JetEngineCCTEntriesWithFilter {
# Filter by IDs
countByIds: jetengineCCTEntryCount(cctSlug: "sample_cct", filter: {
ids: [1, 3]
})
entriesByIds: jetengineCCTEntries(cctSlug: "sample_cct", filter: {
ids: [1, 3]
}) {
id
}
# Filter by field (EQUALS)
entriesByAuthor: jetengineCCTEntries(cctSlug: "sample_cct", filter: {
search: [{ field: "cct_author_id", value: 1, operator: EQUALS }]
}) {
id
authorID
}
entriesByLabel: jetengineCCTEntries(cctSlug: "sample_cct", filter: {
search: [{ field: "label_text", value: "Some label" }]
}) {
id
label_text: fieldValue(slug: "label_text")
}
# Filter by field (LIKE)
entriesByTextareaLike: jetengineCCTEntries(cctSlug: "sample_cct", filter: {
search: [{ field: "textarea", value: "description", operator: LIKE }]
}) {
id
textarea: fieldValue(slug: "textarea")
}
# Combine ids + search
entriesByIdsAndSearch: jetengineCCTEntries(cctSlug: "sample_cct", filter: {
ids: [1, 4],
search: [{ field: "textarea", value: "description", operator: LIKE }]
}) {
id
textarea: fieldValue(slug: "textarea")
}
}Pagination and sort
List queries accept pagination: { limit, offset } and sort: { by, order }. Sort by built-in keys such as _ID, cct_created, cct_modified, or by any CCT field slug.
query JetEngineCCTEntriesWithPagination {
entriesWithLimit: jetengineCCTEntries(cctSlug: "sample_cct", pagination: { limit: 2 }) {
id
createdDate
textarea: fieldValue(slug: "textarea")
}
entriesPage2: jetengineCCTEntries(cctSlug: "sample_cct", pagination: { limit: 1, offset: 1 }) {
id
createdDate
textarea: fieldValue(slug: "textarea")
}
entriesSortByCreatedDesc: jetengineCCTEntries(cctSlug: "sample_cct", sort: { by: "cct_created", order: DESC }) {
id
createdDate
textarea: fieldValue(slug: "textarea")
}
entriesSortByIdAsc: jetengineCCTEntries(cctSlug: "sample_cct", sort: { by: "_ID", order: ASC }) {
id
textarea: fieldValue(slug: "textarea")
}
}Filter with pagination
Combine filter, pagination, and sort in list queries; count accepts only filter.
query JetEngineCCTEntriesFilterAndPagination {
jetengineCCTEntryCount(
cctSlug: "sample_cct"
filter: { search: [{ field: "textarea", value: "description", operator: LIKE }] }
)
jetengineCCTEntries(
cctSlug: "sample_cct"
filter: { search: [{ field: "textarea", value: "description", operator: LIKE }] }
pagination: { limit: 10, offset: 0 }
sort: { by: "cct_created", order: DESC }
) {
id
textarea: fieldValue(slug: "textarea")
}
}