The GraphQL schema is provided by the paid GraphQL and REST add-on. Every query and mutation needs a licensed domain.
About the add-on#
- GraphQL types: Types: Query, Mutation, inputs CwBlogPostFilterInput, CwBlogPostSortInput, CwBlogAddCommentInput; enum CwBlogPostSortField (PUBLISHED_AT, TITLE, READING_MINUTES, CREATED_AT); object types CwBlogPosts, CwBlogPost, CwBlogBlock, CwBlogFaq, CwBlogMeta, CwBlogKeyValue, CwBlogHreflang, CwBlogCategory, CwBlogTags, CwBlogTag, CwBlogAuthor, CwBlogAuthorLink, CwBlogComment, CwBlogAddCommentOutput. Reuses Magento SortEnum, SearchResultPageInfo and ProductInterface.
- RATE_LIMITED error: A rate-limited comment fails with GraphQlInputException extensions.code RATE_LIMITED. Spam or captcha refusals return the generic storefront message. Unlicensed domain: authorisation error on every query/mutation.
- CoullWorks Blog GraphQL & REST add-on: Separate paid module; requires coullworks/module-blog and Magento GraphQL, Catalog GraphQL, Store GraphQL, Customer, Webapi and Widget modules. No admin screen and no configuration of its own. Licence gate on every resolver (plugin GateResolvers) and REST route (plugin GateRoutes).
Queries and mutations#
cwBlogPosts#
Posts the reader can see, with filters, sort and paging. Resolver CoullWorks\BlogGraphQl\Model\Resolver\Posts. Cache identity CoullWorks\BlogGraphQl\Model\Cache\PostsIdentity.
| Argument | Type | Default | Notes |
|---|
filter | CwBlogPostFilterInput | none | Optional. |
sort | CwBlogPostSortInput | none | Optional. |
pageSize | Int | 12 | Optional; default 12; page size must be 1..100 (Args::MAX_PAGE_SIZE). |
currentPage | Int | 1 | Optional; default 1. |
cwBlogPost#
One post by url key or id. A draft, scheduled, disabled or other-store post is a no-such-entity error. Resolver CoullWorks\BlogGraphQl\Model\Resolver\Post. Cache identity CoullWorks\BlogGraphQl\Model\Cache\SinglePostIdentity.
| Argument | Type | Default | Notes |
|---|
url_key | String | none | Optional. |
id | Int | none | Optional. |
cwBlogCategories#
Visible categories under parent_id, or the roots. Resolver CoullWorks\BlogGraphQl\Model\Resolver\Categories. Cache identity CoullWorks\BlogGraphQl\Model\Cache\CategoriesIdentity.
| Argument | Type | Default | Notes |
|---|
parent_id | Int | none | Optional. |
cwBlogCategory#
One category by url key. Resolver CoullWorks\BlogGraphQl\Model\Resolver\Category. Cache identity CoullWorks\BlogGraphQl\Model\Cache\CategoryIdentity.
| Argument | Type | Default | Notes |
|---|
url_key | String! | none | Required. |
cwBlogTags#
Visible tags, paged. Resolver CoullWorks\BlogGraphQl\Model\Resolver\Tags. Cache identity CoullWorks\BlogGraphQl\Model\Cache\TagsIdentity.
| Argument | Type | Default | Notes |
|---|
pageSize | Int | 50 | Optional; default 50; page size must be 1..100 (Args::MAX_PAGE_SIZE). |
currentPage | Int | 1 | Optional; default 1. |
cwBlogTag#
One tag by url key. Resolver CoullWorks\BlogGraphQl\Model\Resolver\Tag. Cache identity CoullWorks\BlogGraphQl\Model\Cache\TagIdentity.
| Argument | Type | Default | Notes |
|---|
url_key | String! | none | Required. |
cwBlogAuthors#
Active authors. Resolver CoullWorks\BlogGraphQl\Model\Resolver\Authors. Cache identity CoullWorks\BlogGraphQl\Model\Cache\AuthorsIdentity.
cwBlogAuthor#
One author by url key. Resolver CoullWorks\BlogGraphQl\Model\Resolver\Author. Cache identity CoullWorks\BlogGraphQl\Model\Cache\AuthorIdentity.
| Argument | Type | Default | Notes |
|---|
url_key | String! | none | Required. |
cwBlogSearch#
Articles matching a query. Resolver CoullWorks\BlogGraphQl\Model\Resolver\Search. Cache identity CoullWorks\BlogGraphQl\Model\Cache\PostsIdentity.
| Argument | Type | Default | Notes |
|---|
query | String! | none | Required. |
pageSize | Int | 12 | Optional; default 12; page size must be 1..100 (Args::MAX_PAGE_SIZE). |
currentPage | Int | 1 | Optional; default 1. |
Approved comments of a visible post. Resolver CoullWorks\BlogGraphQl\Model\Resolver\Comments. Cache identity CoullWorks\BlogGraphQl\Model\Cache\CommentsIdentity.
| Argument | Type | Default | Notes |
|---|
post_id | Int! | none | Required. |
The timing token to send as token in cwBlogAddComment, for a post the reader can see. Not cached. Resolver CoullWorks\BlogGraphQl\Model\Resolver\CommentToken. Not cached.
| Argument | Type | Default | Notes |
|---|
post_id | Int! | none | Required. |
cwBlogBlockSchema#
The structured block schema as JSON. Resolver CoullWorks\BlogGraphQl\Model\Resolver\BlockSchema. Not cached.
Adds a comment as a guest or, with a customer token, as the customer. It follows the same rules as the storefront form. Resolver CoullWorks\BlogGraphQl\Model\Resolver\AddComment. Not cached.
| Argument | Type | Default | Notes |
|---|
input | CwBlogAddCommentInput! | none | Required. |
Types#
CwBlogPostFilterInput (input)#
| Field | Type | What it is |
|---|
category_id | Int | Posts in this category. |
tag_id | Int | Posts with this tag. |
author_id | Int | Posts written or co-written by this author. Cannot be combined with search. |
search | String | Full-text search; category_id and tag_id narrow it. |
CwBlogPostSortInput (input)#
| Field | Type | What it is |
|---|
field | CwBlogPostSortField = PUBLISHED_AT | The field to sort by. One of the CwBlogPostSortField values. Defaults to PUBLISHED_AT. |
direction | SortEnum = DESC | Sort direction, ASC or DESC. Defaults to DESC. |
CwBlogPostSortField (enum)#
| Field | Type | What it is |
|---|
PUBLISHED_AT | enum value | Sort field of cwBlogPosts sort.field. |
TITLE | enum value | Sort field of cwBlogPosts sort.field. |
READING_MINUTES | enum value | Sort field of cwBlogPosts sort.field. |
CREATED_AT | enum value | Sort field of cwBlogPosts sort.field. |
CwBlogPosts (type)#
| Field | Type | What it is |
|---|
items | [CwBlogPost!]! | The posts on this page. |
total_count | Int! | How many posts the reader can see for this query. |
page_info | SearchResultPageInfo | Paging information for the result (current page, page size and total pages). |
CwBlogPost (type)#
| Field | Type | What it is |
|---|
id | Int! | The post id. |
url_key | String! | The post's URL key. |
url | String | The canonical address of the post. Resolver CoullWorks\BlogGraphQl\Model\Resolver\PostSeo. |
title | String! | The post title. |
short_content | String | The short summary of the post. |
featured_image | String | Full address of the featured image, empty when none. |
featured_image_alt | String | Alternative text of the featured image. |
published_at | String | When the post was published. |
updated_at | String | When the post was last updated. |
reading_minutes | Int! | Estimated reading time in minutes. |
is_ai_assisted | Boolean! | Whether the post was written with the AI Writer. |
show_ai_disclosure | Boolean | The per-post override for showing the AI disclosure line. Null means the store setting applies. |
comments_closed | Boolean | Whether comments are closed on this post. Null means the store default applies. |
template | String | The post template name. |
content_html | String | The body with directives, media and widgets resolved, as the storefront prints it. Resolver CoullWorks\BlogGraphQl\Model\Resolver\PostContent. |
content_blocks | [CwBlogBlock!] | The body as structured blocks. Resolver CoullWorks\BlogGraphQl\Model\Resolver\PostContent. |
takeaways | [String!]! | The key takeaways of the post, as plain strings. |
faqs | [CwBlogFaq!]! | The post's questions and answers. |
categories | [CwBlogCategory!]! | Resolver CoullWorks\BlogGraphQl\Model\Resolver\PostRelations. |
tags | [CwBlogTag!]! | Resolver CoullWorks\BlogGraphQl\Model\Resolver\PostRelations. |
author | CwBlogAuthor | Resolver CoullWorks\BlogGraphQl\Model\Resolver\PostRelations. |
coauthors | [CwBlogAuthor!]! | Resolver CoullWorks\BlogGraphQl\Model\Resolver\PostRelations. |
related_posts | [CwBlogPost!]! | Resolver CoullWorks\BlogGraphQl\Model\Resolver\PostRelations. |
related_products | [ProductInterface] | Products picked for the post that the reader's store and customer group may see. Resolver CoullWorks\BlogGraphQl\Model\Resolver\RelatedProducts. |
meta | CwBlogMeta | Resolver CoullWorks\BlogGraphQl\Model\Resolver\PostSeo. |
json_ld | [String!]! | JSON-LD documents, one JSON string each, as in the storefront page head. Resolver CoullWorks\BlogGraphQl\Model\Resolver\PostSeo. |
hreflang | [CwBlogHreflang!]! | Resolver CoullWorks\BlogGraphQl\Model\Resolver\PostSeo. |
CwBlogBlock (type)#
| Field | Type | What it is |
|---|
type | String! | The block type code. |
data | String! | The block's data as a JSON string, shaped as cwBlogBlockSchema describes. |
children | [CwBlogBlock!] | The blocks nested inside this block, when it holds any. |
CwBlogFaq (type)#
| Field | Type | What it is |
|---|
question | String! | The question. |
answer | String! | The answer. |
CwBlogMeta (type)#
| Field | Type | What it is |
|---|
title | String! | The page title for search results. |
description | String! | The meta description. |
robots | String! | The robots directive of the page. |
canonical | String! | The canonical address of the page. |
og | [CwBlogKeyValue!]! | The Open Graph tags as key and value pairs. |
twitter | [CwBlogKeyValue!]! | The Twitter card tags as key and value pairs. |
prev | String | The address of the previous page of a paged listing, when there is one. |
next | String | The address of the next page of a paged listing, when there is one. |
CwBlogKeyValue (type)#
| Field | Type | What it is |
|---|
key | String! | The tag name. |
value | String! | The tag value. |
CwBlogHreflang (type)#
| Field | Type | What it is |
|---|
hreflang | String! | The language code of the alternate. |
href | String! | The address of the alternate. |
CwBlogCategory (type)#
| Field | Type | What it is |
|---|
id | Int! | The category id. |
parent_id | Int | The parent category id, null for a root category. |
url_key | String! | The category's URL key. |
url | String | Resolver CoullWorks\BlogGraphQl\Model\Resolver\EntityUrl. |
title | String! | The category title. |
description | String | The category description. |
image | String | The category image. |
level | Int! | How deep the category sits in the tree. |
position | Int! | The category's position among its siblings. |
meta_title | String | The category's meta title. |
meta_description | String | The category's meta description. |
include_in_menu | Boolean! | Whether the category is included in menus. |
children | [CwBlogCategory!]! | Resolver CoullWorks\BlogGraphQl\Model\Resolver\CategoryChildren. |
CwBlogTags (type)#
| Field | Type | What it is |
|---|
items | [CwBlogTag!]! | The tags on this page. |
total_count | Int! | How many tags there are. |
page_info | SearchResultPageInfo | Paging information for the result. |
CwBlogTag (type)#
| Field | Type | What it is |
|---|
id | Int! | The tag id. |
url_key | String! | The tag's URL key. |
url | String | Resolver CoullWorks\BlogGraphQl\Model\Resolver\EntityUrl. |
title | String! | The tag title. |
description | String | The tag description. |
meta_title | String | The tag's meta title. |
meta_description | String | The tag's meta description. |
CwBlogAuthor (type)#
| Field | Type | What it is |
|---|
id | Int! | The author id. |
url_key | String! | The author's URL key. |
url | String | Resolver CoullWorks\BlogGraphQl\Model\Resolver\EntityUrl. |
name | String! | The author's name. |
job_title | String | The author's job title. |
bio | String | The author's biography. |
avatar | String | The author's avatar image. |
links | [CwBlogAuthorLink!]! | The author's profile links. |
CwBlogAuthorLink (type)#
| Field | Type | What it is |
|---|
network | String! | The network the link points to. |
url | String! | The address of the profile. |
| Field | Type | What it is |
|---|
id | Int! | The comment id. |
post_id | Int! | The id of the post the comment belongs to. |
parent_id | Int | The id of the comment this one replies to, null for a top-level comment. |
author_name | String! | The name the commenter gave. |
content | String! | The comment text. |
created_at | String | When the comment was made. |
is_admin_reply | Boolean! | Whether a staff member wrote the comment as a reply. |
| Field | Type | What it is |
|---|
post_id | Int! | The id of the post to comment on. |
name | String | The commenter's name. |
email | String | The commenter's email address. |
content | String! | The comment text. |
parent_id | Int | The id of the comment being replied to. |
notify_on_reply | Boolean | Whether to email the commenter when someone replies. |
honeypot | String | The hidden spam-trap field. Leave it empty; a value marks the comment as spam. |
token | String | The timing token issued when the comment form was opened. |
captcha_response | String | The reCAPTCHA response, when reCAPTCHA is enabled for blog comments. |
| Field | Type | What it is |
|---|
status | String! | approved or pending. |
message | String! | A message for the reader, for example that the comment awaits moderation. |
comment_id | Int | The id of the stored comment. |