Anchor to domain
domain
query
Lookup a Domain by ID.
Anchor to Possible returnsPossible returns
- Anchor to DomainDomain•
A unique string that represents the address of a Shopify store on the Internet.
Was this section helpful?
- Retrieve a domain by ID
- Retrieve information about a shop's domains
Examples
1const { admin } = await authenticate.admin(request);23const response = await admin.graphql(4 `#graphql5 query {6 domain(id: "gid://shopify/Domain/948873163") {7 host8 url9 }10 }`,11);1213const data = await response.json();14
query {
domain(id: "gid://shopify/Domain/948873163") {
host
url
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "query { domain(id: \"gid://shopify/Domain/948873163\") { host url } }"
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
query {
domain(id: "gid://shopify/Domain/948873163") {
host
url
}
}`,
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: `query {
domain(id: "gid://shopify/Domain/948873163") {
host
url
}
}`,
});
session = ShopifyAPI::Auth::Session.new(
shop: "your-development-store.myshopify.com",
access_token: access_token
)
client = ShopifyAPI::Clients::Graphql::Admin.new(
session: session
)
query = <<~QUERY
query {
domain(id: "gid://shopify/Domain/948873163") {
host
url
}
}
QUERY
response = client.query(query: query)
Response
JSON1{2 "domain": {3 "host": "www.snowdevil.ca",4 "url": "https://www.snowdevil.ca"5 }6}