Re: Pages field on QueryRoot for Storefront API

Pages field on QueryRoot for Storefront API

RYAN_CHANG
Shopify Partner
8 0 2

Has the pages field been deprecated on QueryRoot? Or was it just never implemented? It's not working for me. Appreciate any answers 🙂

Replies 5 (5)

KarlOffenberger
Shopify Partner
1873 184 901

Hi Ryan,

Works just fine.

I noticed you write field in your question. The pages property is a connection so it isn't queried like a field.

Have you tried it like so?

query {
  pages(first:10) {
    edges {
      node {
        handle
      }
    }
  }
}

Let me know if above works for you.

RYAN_CHANG
Shopify Partner
8 0 2

Hey Karl! Thanks for the reply. Here's what's going on in my GraphiQL tool.

RYAN_CHANG
Shopify Partner
8 0 2
{
  "errors": [
    {
      "message": "Field 'pages' doesn't exist on type 'QueryRoot'",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "fields": [
        "query",
        "pages"
      ]
    }
  ]
}

 

KarlOffenberger
Shopify Partner
1873 184 901

Hmm... Ryan, what GraphQL endpoint are you hitting? Shopify has 2, the Storefront and the Admin. You may be trying to query the wrong one.

RYAN_CHANG
Shopify Partner
8 0 2

Karl, you're right, the GraphiQL tool in my App section is hooked up to the Admin API oops, lol.