FROM CACHE - en_header
Return management just got easier! We’ve launched Customer Self-Serve Returns to all Shopify merchants. Click here to learn more!

How list all domains attached to shop using GraphQL Admin query

Solved
Camil
Tourist
15 0 1

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

Accepted Solution (1)

Accepted Solutions
Kevin_A
Shopify Staff
Shopify Staff
318 42 61

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 | Solutions Engineer @ 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)
Kevin_A
Shopify Staff
Shopify Staff
318 42 61

Hey @Camil 

This should work for you 

{
  shop{
    id
    name
    domains{
      url
    }
  }
}

 

Kevin_A | Solutions Engineer @ 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

Camil
Tourist
15 0 1

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?

Kevin_A
Shopify Staff
Shopify Staff
318 42 61

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 | Solutions Engineer @ 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

Camil
Tourist
15 0 1

You'r both answers are correct:)

Thank You for Your time.