Anchor to marketingEventmarketing
marketingEvent
query
Returns a MarketingEvent resource by ID.
Anchor to Possible returnsPossible returns
- Anchor to MarketingEventMarketing•
Event Represents actions that market a merchant's store or products.
Was this section helpful?
Retrieves a single marketing event
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
query MarketingEventShow {
marketingEvent(id: "gid://shopify/MarketingEvent/425025702") {
id
type
remoteId
startedAt
endedAt
scheduledToEndAt
manageUrl
previewUrl
utmCampaign
utmMedium
utmSource
description
marketingChannelType
sourceAndMedium
}
}`,
);
const data = await response.json();
query MarketingEventShow {
marketingEvent(id: "gid://shopify/MarketingEvent/425025702") {
id
type
remoteId
startedAt
endedAt
scheduledToEndAt
manageUrl
previewUrl
utmCampaign
utmMedium
utmSource
description
marketingChannelType
sourceAndMedium
}
}
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 MarketingEventShow { marketingEvent(id: \"gid://shopify/MarketingEvent/425025702\") { id type remoteId startedAt endedAt scheduledToEndAt manageUrl previewUrl utmCampaign utmMedium utmSource description marketingChannelType sourceAndMedium } }"
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
query MarketingEventShow {
marketingEvent(id: "gid://shopify/MarketingEvent/425025702") {
id
type
remoteId
startedAt
endedAt
scheduledToEndAt
manageUrl
previewUrl
utmCampaign
utmMedium
utmSource
description
marketingChannelType
sourceAndMedium
}
}`,
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: `query MarketingEventShow {
marketingEvent(id: "gid://shopify/MarketingEvent/425025702") {
id
type
remoteId
startedAt
endedAt
scheduledToEndAt
manageUrl
previewUrl
utmCampaign
utmMedium
utmSource
description
marketingChannelType
sourceAndMedium
}
}`,
});
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 MarketingEventShow {
marketingEvent(id: "gid://shopify/MarketingEvent/425025702") {
id
type
remoteId
startedAt
endedAt
scheduledToEndAt
manageUrl
previewUrl
utmCampaign
utmMedium
utmSource
description
marketingChannelType
sourceAndMedium
}
}
QUERY
response = client.query(query: query)
Response
JSON{
"marketingEvent": {
"id": "gid://shopify/MarketingEvent/425025702",
"type": "NEWSLETTER",
"remoteId": null,
"startedAt": "2024-11-08T20:47:51Z",
"endedAt": null,
"scheduledToEndAt": null,
"manageUrl": null,
"previewUrl": null,
"utmCampaign": "asdf",
"utmMedium": "newsletter",
"utmSource": "email",
"description": null,
"marketingChannelType": "EMAIL",
"sourceAndMedium": "Email newsletter"
}
}