Version: 2024-07
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-07/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query MarketingEventList { marketingEvents(first: 10) { edges { node { id type remoteId startedAt endedAt scheduledToEndAt manageUrl previewUrl utmCampaign utmMedium utmSource description marketingChannelType sourceAndMedium } } pageInfo { hasNextPage endCursor } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query MarketingEventList {\n marketingEvents(first: 10) {\n edges {\n node {\n id\n type\n remoteId\n startedAt\n endedAt\n scheduledToEndAt\n manageUrl\n previewUrl\n utmCampaign\n utmMedium\n utmSource\n description\n marketingChannelType\n sourceAndMedium\n }\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }`,\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n query MarketingEventList {\n marketingEvents(first: 10) {\n edges {\n node {\n id\n type\n remoteId\n startedAt\n endedAt\n scheduledToEndAt\n manageUrl\n previewUrl\n utmCampaign\n utmMedium\n utmSource\n description\n marketingChannelType\n sourceAndMedium\n }\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query MarketingEventList {\n marketingEvents(first: 10) {\n edges {\n node {\n id\n type\n remoteId\n startedAt\n endedAt\n scheduledToEndAt\n manageUrl\n previewUrl\n utmCampaign\n utmMedium\n utmSource\n description\n marketingChannelType\n sourceAndMedium\n }\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query MarketingEventList {\n marketingEvents(first: 10) {\n edges {\n node {\n id\n type\n remoteId\n startedAt\n endedAt\n scheduledToEndAt\n manageUrl\n previewUrl\n utmCampaign\n utmMedium\n utmSource\n description\n marketingChannelType\n sourceAndMedium\n }\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query MarketingEventList {\n marketingEvents(first: 10) {\n edges {\n node {\n id\n type\n remoteId\n startedAt\n endedAt\n scheduledToEndAt\n manageUrl\n previewUrl\n utmCampaign\n utmMedium\n utmSource\n description\n marketingChannelType\n sourceAndMedium\n }\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n}"
input: null
response: { "data": { "marketingEvents": { "edges": [ { "node": { "id": "gid://shopify/MarketingEvent/40997430", "type": "AD", "remoteId": "2345:6789", "startedAt": "2012-01-01T00:00:00Z", "endedAt": null, "scheduledToEndAt": null, "manageUrl": null, "previewUrl": null, "utmCampaign": "1234567899", "utmMedium": "facebook-ad", "utmSource": "facebook", "description": null, "marketingChannelType": "SOCIAL", "sourceAndMedium": "Facebook ad" } }, { "node": { "id": "gid://shopify/MarketingEvent/56540067", "type": "NEWSLETTER", "remoteId": "222", "startedAt": "2024-11-17T20:47:51Z", "endedAt": null, "scheduledToEndAt": null, "manageUrl": "https://example.com", "previewUrl": "https://example.com/image.png", "utmCampaign": null, "utmMedium": null, "utmSource": null, "description": "External Marketing Activity Campaign", "marketingChannelType": "DISPLAY", "sourceAndMedium": "Display newsletter" } }, { "node": { "id": "gid://shopify/MarketingEvent/151661601", "type": "NEWSLETTER", "remoteId": null, "startedAt": "2024-11-08T20:47:51Z", "endedAt": null, "scheduledToEndAt": null, "manageUrl": null, "previewUrl": null, "utmCampaign": "email-for-deleted-automation", "utmMedium": "newsletter", "utmSource": "email", "description": null, "marketingChannelType": "EMAIL", "sourceAndMedium": "Email newsletter" } }, { "node": { "id": "gid://shopify/MarketingEvent/178808684", "type": "AD", "remoteId": null, "startedAt": "2012-01-01T00:00:00Z", "endedAt": null, "scheduledToEndAt": null, "manageUrl": null, "previewUrl": null, "utmCampaign": "google-shopping", "utmMedium": "ad", "utmSource": "google", "description": null, "marketingChannelType": "SEARCH", "sourceAndMedium": "Google ad" } }, { "node": { "id": "gid://shopify/MarketingEvent/179113300", "type": "ABANDONED_CART", "remoteId": null, "startedAt": "2024-11-03T20:47:51Z", "endedAt": null, "scheduledToEndAt": null, "manageUrl": null, "previewUrl": null, "utmCampaign": "shopify_abandoned_checkout_email-1519754247", "utmMedium": "email", "utmSource": "abandoned_cart", "description": null, "marketingChannelType": "EMAIL", "sourceAndMedium": "Abandoned cart email" } }, { "node": { "id": "gid://shopify/MarketingEvent/216774463", "type": "NEWSLETTER", "remoteId": "333", "startedAt": "2024-11-17T20:47:51Z", "endedAt": null, "scheduledToEndAt": null, "manageUrl": "https://example.com", "previewUrl": "https://example.com/image.png", "utmCampaign": null, "utmMedium": null, "utmSource": null, "description": "External Marketing Activity Ad Group", "marketingChannelType": "DISPLAY", "sourceAndMedium": "Display newsletter" } }, { "node": { "id": "gid://shopify/MarketingEvent/264437935", "type": "NEWSLETTER", "remoteId": "444", "startedAt": "2024-11-17T20:47:51Z", "endedAt": null, "scheduledToEndAt": null, "manageUrl": "https://example.com", "previewUrl": "https://example.com/image.png", "utmCampaign": null, "utmMedium": null, "utmSource": null, "description": "External Marketing Activity Ad", "marketingChannelType": "DISPLAY", "sourceAndMedium": "Display newsletter" } }, { "node": { "id": "gid://shopify/MarketingEvent/283266064", "type": "AD", "remoteId": null, "startedAt": "2012-01-01T00:00:00Z", "endedAt": null, "scheduledToEndAt": null, "manageUrl": null, "previewUrl": null, "utmCampaign": "google-shopping-4", "utmMedium": "ad", "utmSource": "google", "description": "Marketing Activity 4 for Snowdevil", "marketingChannelType": "SEARCH", "sourceAndMedium": "Google ad" } }, { "node": { "id": "gid://shopify/MarketingEvent/325573600", "type": "POST", "remoteId": "1234:56779989", "startedAt": "2024-11-17T20:47:51Z", "endedAt": null, "scheduledToEndAt": null, "manageUrl": null, "previewUrl": null, "utmCampaign": "123456789000", "utmMedium": "facebook-post", "utmSource": "facebook", "description": null, "marketingChannelType": "SOCIAL", "sourceAndMedium": "Facebook post" } }, { "node": { "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" } } ], "pageInfo": { "hasNextPage": true, "endCursor": "eyJsYXN0X2lkIjo0MjUwMjU3MDIsImxhc3RfdmFsdWUiOiI0MjUwMjU3MDIifQ==" } } } }