Support for Pages and Blog Articles in GraphQL Admin API

Solved
scottn
Shopify Partner
6 0 2

Is there support for pages and blog articles in the GraphQL Admin API? I'm not seeing it. Are people just using both REST and GraphQL to cover all their bases?

 

I did notice the Storefront API, but it seems to be read only.

 

My use case is migrating lots of data (products, articles, pages, customers, orders) from our old site to Shopify.

Accepted Solution (1)
Liam
Shopify Staff
Shopify Staff
1868 196 572

This is an accepted solution.

Hi Friendscottn,

 

From looking into this it does seem that the GraphQL API doesn't currently support mutations for creating pages or blog articles - so you would have to use the REST endpoints POST/admin/api/2023-10/pages.json endpoint for pages and the POST /admin/api/2023-10/blogs/{blog_id}/articles.json for blog articles.

 

Hope this helps!

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

View solution in original post

Replies 4 (4)
Liam
Shopify Staff
Shopify Staff
1868 196 572

This is an accepted solution.

Hi Friendscottn,

 

From looking into this it does seem that the GraphQL API doesn't currently support mutations for creating pages or blog articles - so you would have to use the REST endpoints POST/admin/api/2023-10/pages.json endpoint for pages and the POST /admin/api/2023-10/blogs/{blog_id}/articles.json for blog articles.

 

Hope this helps!

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

scottn
Shopify Partner
6 0 2

Hi @Liam

Thanks for confirming that for me. Super helpful.

Is the idea that eventually the GraphQL Admin API will have full coverage of these types of resources?

 

I had initially selected the GraphQL API for my project because it seemed to have better support for searching resources than the Rest API does.

 

Using both APIs in my one off data migration app feels awkward, but hey we do what we have to 😃

cornholio
Shopify Partner
1 0 0

Are there any plans to add this to the GraphQL endpoints? Also, i cant seem to find the REST documentation anywhere. Could you point me in the right direction?

friendscottn
Shopify Partner
5 1 2

Not sure about the plans for GraphQL. I hope so. Here's the REST docs for pages and articles: 

https://shopify.dev/docs/api/admin-rest/2023-10/resources/page

https://shopify.dev/docs/api/admin-rest/2023-10/resources/article