Fetch blogs data using storefront API

Solved

Fetch blogs data using storefront API

aemzano
Shopify Partner
6 0 0

Hi, anyone knows how to query all the blogs in shopify using storefront API? thanks

Accepted Solution (1)

Ari9
Excursionist
35 3 11

This is an accepted solution.

It's on the documentation. Just googled "Shopify Blog Api" and this is the first result: https://shopify.dev/docs/admin-api/rest/reference/online-store/blog
banned

View solution in original post

Replies 2 (2)

Ari9
Excursionist
35 3 11

This is an accepted solution.

It's on the documentation. Just googled "Shopify Blog Api" and this is the first result: https://shopify.dev/docs/admin-api/rest/reference/online-store/blog
banned

David-9
New Member
5 0 0

The accepted solution works, but OP asked for Storefront API rather than the Admin API. Here is how you would query blogs in the Storefront API. 

 

query BlogPosts($query: String!) {
  articles(query: $query, first: 10) {
    edges {
      node {
        id
        title
        excerpt
        image {
          url
          altText
        }
      }
    }
  }
}

Also, keep in mind you can increase the value for "first: <value>" to however many blog posts you want to return.

 

Hope this helps.