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
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();
query {
domain(id: "gid://shopify/Domain/948873163") {
host
url
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2024-04/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
JSON{
"domain": {
"host": "www.snowdevil.ca",
"url": "https://www.snowdevil.ca"
}
}