How list all domains attached to shop using GraphQL Admin query

Solved
Highlighted
New Member
13 0 0

Hello,

I can see that inside Shop object i should be able to see all domains attached to store.

https://shopify.dev/docs/admin-api/graphql/reference/object/shop?api[version]=2020-07

object: 

domains ([Domain!]!)

The domains configured for the shop.


I would like get this elements but following code fail,
Could someone help me out how to fetch this values?
Bellow is my code that i'm trying to use:

query {
shop {
id
name
domains(first:10)
{
node
{
url
}
}

}
}

 

regards

0 Likes
Highlighted
Shopify Staff
Shopify Staff
57 6 11

Hey @Camil 

This should work for you 

{
  shop{
    id
    name
    domains{
      url
    }
  }
}

 

Kevin_A | Developer Support @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

0 Likes
Highlighted
New Member
13 0 0

Thank You for reply,

I tried but got response:

      "message" => "Field 'domains' doesn't exist on type 'Shop'"

 Im not sure why, any others thoughts?

0 Likes
Highlighted
Shopify Staff
Shopify Staff
57 6 11

This is an accepted solution.

Hey @Camil 

Based on the error it looks like you are not using API version `2020-07`. The domains field was not available in previous versions. 

Kevin_A | Developer Support @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

1 Like
Highlighted
New Member
13 0 0

You'r both answers are correct:)

Thank You for Your time.

0 Likes