Anchor to event
event
query
Get a single event by its id.
Anchor to Possible returnsPossible returns
- Anchor to EventEvent•
Events chronicle resource activities such as the creation of an article, the fulfillment of an order, or the addition of a product.
Was this section helpful?
- Retrieve the first basic-event
- Retrieves a single event
Examples
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
query {
event(id: "gid://shopify/BasicEvent/422690323") {
id
message
... on BasicEvent {
action
subjectType
subject {
__typename
}
}
}
}`,
);
const data = await response.json();
query {
event(id: "gid://shopify/BasicEvent/422690323") {
id
message
... on BasicEvent {
action
subjectType
subject {
__typename
}
}
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "query { event(id: \"gid://shopify/BasicEvent/422690323\") { id message ... on BasicEvent { action subjectType subject { __typename } } } }"
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
query {
event(id: "gid://shopify/BasicEvent/422690323") {
id
message
... on BasicEvent {
action
subjectType
subject {
__typename
}
}
}
}`,
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: `query {
event(id: "gid://shopify/BasicEvent/422690323") {
id
message
... on BasicEvent {
action
subjectType
subject {
__typename
}
}
}
}`,
});
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 {
event(id: "gid://shopify/BasicEvent/422690323") {
id
message
... on BasicEvent {
action
subjectType
subject {
__typename
}
}
}
}
QUERY
response = client.query(query: query)
Response
JSON{
"event": {
"id": "gid://shopify/BasicEvent/422690323",
"message": "bob bobsen included a product on Online Store: <a href=\"https://admin.myshopify.io/store/snowdevil/admin/products/440089423\">IPod Nano - 8GB</a>.",
"action": "published",
"subjectType": "PRODUCT",
"subject": {
"__typename": "Product"
}
}
}