Support for Pages and Blog Articles in GraphQL Admin API

Solved

Support for Pages and Blog Articles in GraphQL Admin API

scottn
Shopify Partner
8 0 5

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
2860 312 812

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 5 (5)

Liam
Shopify Staff
2860 312 812

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
8 0 5

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
16 3 8

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

JoshHighland
Shopify Partner
213 12 76

The REST API is SO SLOW compared to GraphQL. 

 

Im trying to pull page data and metafields for that page. This results in 2 separate REST calls. Thats 2x the work on much slower endpoints.

 

Please lets get this added to the the roadmap

SEO Manager - The all-in-One SEO solution for Shopify
A powerful suite of SEO tools that gets you found in Google results

- Install SEO Manager -