How to Use cmsPage and cmsBlocks GraphQL Query in Magento 2?

cmsPage and cmsBlocks GraphQL Query Magento used to display CMS related information.

You can use cmsPage for the CMS Page related data whereas cmsBlock used to display CMS Static Block related information.

schema.graphql file for the CMS module will be available on file, vendor/magento/module-cms-graph-ql/etc/schema.graphqls

Example with a query,

1) CMS Page Query,

You need to pass the identifier value of the cms page to retrieve information on the specific Page. I have used the home as an identifier to fetch data of HomePage.

The Output will be Page related Data.

2) CMS Static Block Query,

You have to pass a string of arrays as the identifier value of the static block.

Correct Value:

Incorrect Value:

identifiers: [String] @doc(description: "Identifiers of the CMS blocks")

You can add one or more of the static block ids as a string in identifiers.

The output will be the identifier, title, and content of the static block.

You can be also interested to check, How to Use Product Query GraphQl Magento 2?