Version: 2024-10
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation M($marketingEngagement: MarketingEngagementInput!, $marketingActivityId: ID, $channelHandle: String, $remoteId: String) { marketingEngagementCreate(marketingEngagement: $marketingEngagement, marketingActivityId: $marketingActivityId, channelHandle: $channelHandle, remoteId: $remoteId) { marketingEngagement { occurredOn utcOffset isCumulative adSpend { amount currencyCode } clicksCount impressionsCount commentsCount favoritesCount unsubscribesCount complaintsCount failsCount sendsCount uniqueViewsCount uniqueClicksCount sharesCount viewsCount sessionsCount sales { amount currencyCode } orders firstTimeCustomers returningCustomers marketingActivity { id } channelHandle } userErrors { field message } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `mutation M($marketingEngagement: MarketingEngagementInput!, $marketingActivityId: ID, $channelHandle: String, $remoteId: String) {\n marketingEngagementCreate(marketingEngagement: $marketingEngagement, marketingActivityId: $marketingActivityId, channelHandle: $channelHandle, remoteId: $remoteId) {\n marketingEngagement {\n occurredOn\n utcOffset\n isCumulative\n adSpend {\n amount\n currencyCode\n }\n clicksCount\n impressionsCount\n commentsCount\n favoritesCount\n unsubscribesCount\n complaintsCount\n failsCount\n sendsCount\n uniqueViewsCount\n uniqueClicksCount\n sharesCount\n viewsCount\n sessionsCount\n sales {\n amount\n currencyCode\n }\n orders\n firstTimeCustomers\n returningCustomers\n marketingActivity {\n id\n }\n channelHandle\n }\n userErrors {\n field\n message\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 mutation M($marketingEngagement: MarketingEngagementInput!, $marketingActivityId: ID, $channelHandle: String, $remoteId: String) {\n marketingEngagementCreate(marketingEngagement: $marketingEngagement, marketingActivityId: $marketingActivityId, channelHandle: $channelHandle, remoteId: $remoteId) {\n marketingEngagement {\n occurredOn\n utcOffset\n isCumulative\n adSpend {\n amount\n currencyCode\n }\n clicksCount\n impressionsCount\n commentsCount\n favoritesCount\n unsubscribesCount\n complaintsCount\n failsCount\n sendsCount\n uniqueViewsCount\n uniqueClicksCount\n sharesCount\n viewsCount\n sessionsCount\n sales {\n amount\n currencyCode\n }\n orders\n firstTimeCustomers\n returningCustomers\n marketingActivity {\n id\n }\n channelHandle\n }\n userErrors {\n field\n message\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([\"query\" => $query]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation M($marketingEngagement: MarketingEngagementInput!, $marketingActivityId: ID, $channelHandle: String, $remoteId: String) {\n marketingEngagementCreate(marketingEngagement: $marketingEngagement, marketingActivityId: $marketingActivityId, channelHandle: $channelHandle, remoteId: $remoteId) {\n marketingEngagement {\n occurredOn\n utcOffset\n isCumulative\n adSpend {\n amount\n currencyCode\n }\n clicksCount\n impressionsCount\n commentsCount\n favoritesCount\n unsubscribesCount\n complaintsCount\n failsCount\n sendsCount\n uniqueViewsCount\n uniqueClicksCount\n sharesCount\n viewsCount\n sessionsCount\n sales {\n amount\n currencyCode\n }\n orders\n firstTimeCustomers\n returningCustomers\n marketingActivity {\n id\n }\n channelHandle\n }\n userErrors {\n field\n message\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "mutation M($marketingEngagement: MarketingEngagementInput!, $marketingActivityId: ID, $channelHandle: String, $remoteId: String) {\n marketingEngagementCreate(marketingEngagement: $marketingEngagement, marketingActivityId: $marketingActivityId, channelHandle: $channelHandle, remoteId: $remoteId) {\n marketingEngagement {\n occurredOn\n utcOffset\n isCumulative\n adSpend {\n amount\n currencyCode\n }\n clicksCount\n impressionsCount\n commentsCount\n favoritesCount\n unsubscribesCount\n complaintsCount\n failsCount\n sendsCount\n uniqueViewsCount\n uniqueClicksCount\n sharesCount\n viewsCount\n sessionsCount\n sales {\n amount\n currencyCode\n }\n orders\n firstTimeCustomers\n returningCustomers\n marketingActivity {\n id\n }\n channelHandle\n }\n userErrors {\n field\n message\n }\n }\n}"
input: null
response: { "data": { "marketingEngagementCreate": { "marketingEngagement": { "occurredOn": "2018-06-29", "utcOffset": "-07:00", "isCumulative": false, "adSpend": { "amount": "19.9", "currencyCode": "CAD" }, "clicksCount": 40, "impressionsCount": 100, "commentsCount": 1, "favoritesCount": 0, "unsubscribesCount": 1, "complaintsCount": 1, "failsCount": 1, "sendsCount": 1, "uniqueViewsCount": 1, "uniqueClicksCount": 1, "sharesCount": 5, "viewsCount": 10, "sessionsCount": 40, "sales": { "amount": "304.5", "currencyCode": "CAD" }, "orders": "8.0", "firstTimeCustomers": "5.0", "returningCustomers": "3.0", "marketingActivity": { "id": "gid://shopify/MarketingActivity/794355127" }, "channelHandle": null }, "userErrors": [] } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation M($marketingEngagement: MarketingEngagementInput!, $marketingActivityId: ID, $channelHandle: String, $remoteId: String) { marketingEngagementCreate(marketingEngagement: $marketingEngagement, marketingActivityId: $marketingActivityId, channelHandle: $channelHandle, remoteId: $remoteId) { marketingEngagement { occurredOn utcOffset isCumulative adSpend { amount currencyCode } clicksCount impressionsCount commentsCount favoritesCount unsubscribesCount complaintsCount failsCount sendsCount uniqueViewsCount uniqueClicksCount sharesCount viewsCount sessionsCount sales { amount currencyCode } orders firstTimeCustomers returningCustomers marketingActivity { id } channelHandle } userErrors { field message } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `mutation M($marketingEngagement: MarketingEngagementInput!, $marketingActivityId: ID, $channelHandle: String, $remoteId: String) {\n marketingEngagementCreate(marketingEngagement: $marketingEngagement, marketingActivityId: $marketingActivityId, channelHandle: $channelHandle, remoteId: $remoteId) {\n marketingEngagement {\n occurredOn\n utcOffset\n isCumulative\n adSpend {\n amount\n currencyCode\n }\n clicksCount\n impressionsCount\n commentsCount\n favoritesCount\n unsubscribesCount\n complaintsCount\n failsCount\n sendsCount\n uniqueViewsCount\n uniqueClicksCount\n sharesCount\n viewsCount\n sessionsCount\n sales {\n amount\n currencyCode\n }\n orders\n firstTimeCustomers\n returningCustomers\n marketingActivity {\n id\n }\n channelHandle\n }\n userErrors {\n field\n message\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 mutation M($marketingEngagement: MarketingEngagementInput!, $marketingActivityId: ID, $channelHandle: String, $remoteId: String) {\n marketingEngagementCreate(marketingEngagement: $marketingEngagement, marketingActivityId: $marketingActivityId, channelHandle: $channelHandle, remoteId: $remoteId) {\n marketingEngagement {\n occurredOn\n utcOffset\n isCumulative\n adSpend {\n amount\n currencyCode\n }\n clicksCount\n impressionsCount\n commentsCount\n favoritesCount\n unsubscribesCount\n complaintsCount\n failsCount\n sendsCount\n uniqueViewsCount\n uniqueClicksCount\n sharesCount\n viewsCount\n sessionsCount\n sales {\n amount\n currencyCode\n }\n orders\n firstTimeCustomers\n returningCustomers\n marketingActivity {\n id\n }\n channelHandle\n }\n userErrors {\n field\n message\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([\"query\" => $query]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation M($marketingEngagement: MarketingEngagementInput!, $marketingActivityId: ID, $channelHandle: String, $remoteId: String) {\n marketingEngagementCreate(marketingEngagement: $marketingEngagement, marketingActivityId: $marketingActivityId, channelHandle: $channelHandle, remoteId: $remoteId) {\n marketingEngagement {\n occurredOn\n utcOffset\n isCumulative\n adSpend {\n amount\n currencyCode\n }\n clicksCount\n impressionsCount\n commentsCount\n favoritesCount\n unsubscribesCount\n complaintsCount\n failsCount\n sendsCount\n uniqueViewsCount\n uniqueClicksCount\n sharesCount\n viewsCount\n sessionsCount\n sales {\n amount\n currencyCode\n }\n orders\n firstTimeCustomers\n returningCustomers\n marketingActivity {\n id\n }\n channelHandle\n }\n userErrors {\n field\n message\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "mutation M($marketingEngagement: MarketingEngagementInput!, $marketingActivityId: ID, $channelHandle: String, $remoteId: String) {\n marketingEngagementCreate(marketingEngagement: $marketingEngagement, marketingActivityId: $marketingActivityId, channelHandle: $channelHandle, remoteId: $remoteId) {\n marketingEngagement {\n occurredOn\n utcOffset\n isCumulative\n adSpend {\n amount\n currencyCode\n }\n clicksCount\n impressionsCount\n commentsCount\n favoritesCount\n unsubscribesCount\n complaintsCount\n failsCount\n sendsCount\n uniqueViewsCount\n uniqueClicksCount\n sharesCount\n viewsCount\n sessionsCount\n sales {\n amount\n currencyCode\n }\n orders\n firstTimeCustomers\n returningCustomers\n marketingActivity {\n id\n }\n channelHandle\n }\n userErrors {\n field\n message\n }\n }\n}"
input: null
response: { "data": { "marketingEngagementCreate": { "marketingEngagement": { "occurredOn": "2018-06-29", "utcOffset": "-07:00", "isCumulative": false, "adSpend": { "amount": "19.9", "currencyCode": "CAD" }, "clicksCount": 40, "impressionsCount": 100, "commentsCount": 1, "favoritesCount": 0, "unsubscribesCount": 1, "complaintsCount": 1, "failsCount": 1, "sendsCount": 1, "uniqueViewsCount": 1, "uniqueClicksCount": 1, "sharesCount": 5, "viewsCount": 10, "sessionsCount": 40, "sales": { "amount": "304.5", "currencyCode": "CAD" }, "orders": "8.0", "firstTimeCustomers": "5.0", "returningCustomers": "3.0", "marketingActivity": { "id": "gid://shopify/MarketingActivity/794355127" }, "channelHandle": null }, "userErrors": [] } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation M($marketingEngagement: MarketingEngagementInput!, $marketingActivityId: ID, $channelHandle: String, $remoteId: String) { marketingEngagementCreate(marketingEngagement: $marketingEngagement, marketingActivityId: $marketingActivityId, channelHandle: $channelHandle, remoteId: $remoteId) { marketingEngagement { occurredOn utcOffset isCumulative adSpend { amount currencyCode } clicksCount impressionsCount commentsCount favoritesCount unsubscribesCount complaintsCount failsCount sendsCount uniqueViewsCount uniqueClicksCount sharesCount viewsCount sessionsCount sales { amount currencyCode } orders firstTimeCustomers returningCustomers marketingActivity { id } channelHandle } userErrors { field message } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `mutation M($marketingEngagement: MarketingEngagementInput!, $marketingActivityId: ID, $channelHandle: String, $remoteId: String) {\n marketingEngagementCreate(marketingEngagement: $marketingEngagement, marketingActivityId: $marketingActivityId, channelHandle: $channelHandle, remoteId: $remoteId) {\n marketingEngagement {\n occurredOn\n utcOffset\n isCumulative\n adSpend {\n amount\n currencyCode\n }\n clicksCount\n impressionsCount\n commentsCount\n favoritesCount\n unsubscribesCount\n complaintsCount\n failsCount\n sendsCount\n uniqueViewsCount\n uniqueClicksCount\n sharesCount\n viewsCount\n sessionsCount\n sales {\n amount\n currencyCode\n }\n orders\n firstTimeCustomers\n returningCustomers\n marketingActivity {\n id\n }\n channelHandle\n }\n userErrors {\n field\n message\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 mutation M($marketingEngagement: MarketingEngagementInput!, $marketingActivityId: ID, $channelHandle: String, $remoteId: String) {\n marketingEngagementCreate(marketingEngagement: $marketingEngagement, marketingActivityId: $marketingActivityId, channelHandle: $channelHandle, remoteId: $remoteId) {\n marketingEngagement {\n occurredOn\n utcOffset\n isCumulative\n adSpend {\n amount\n currencyCode\n }\n clicksCount\n impressionsCount\n commentsCount\n favoritesCount\n unsubscribesCount\n complaintsCount\n failsCount\n sendsCount\n uniqueViewsCount\n uniqueClicksCount\n sharesCount\n viewsCount\n sessionsCount\n sales {\n amount\n currencyCode\n }\n orders\n firstTimeCustomers\n returningCustomers\n marketingActivity {\n id\n }\n channelHandle\n }\n userErrors {\n field\n message\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([\"query\" => $query]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation M($marketingEngagement: MarketingEngagementInput!, $marketingActivityId: ID, $channelHandle: String, $remoteId: String) {\n marketingEngagementCreate(marketingEngagement: $marketingEngagement, marketingActivityId: $marketingActivityId, channelHandle: $channelHandle, remoteId: $remoteId) {\n marketingEngagement {\n occurredOn\n utcOffset\n isCumulative\n adSpend {\n amount\n currencyCode\n }\n clicksCount\n impressionsCount\n commentsCount\n favoritesCount\n unsubscribesCount\n complaintsCount\n failsCount\n sendsCount\n uniqueViewsCount\n uniqueClicksCount\n sharesCount\n viewsCount\n sessionsCount\n sales {\n amount\n currencyCode\n }\n orders\n firstTimeCustomers\n returningCustomers\n marketingActivity {\n id\n }\n channelHandle\n }\n userErrors {\n field\n message\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "mutation M($marketingEngagement: MarketingEngagementInput!, $marketingActivityId: ID, $channelHandle: String, $remoteId: String) {\n marketingEngagementCreate(marketingEngagement: $marketingEngagement, marketingActivityId: $marketingActivityId, channelHandle: $channelHandle, remoteId: $remoteId) {\n marketingEngagement {\n occurredOn\n utcOffset\n isCumulative\n adSpend {\n amount\n currencyCode\n }\n clicksCount\n impressionsCount\n commentsCount\n favoritesCount\n unsubscribesCount\n complaintsCount\n failsCount\n sendsCount\n uniqueViewsCount\n uniqueClicksCount\n sharesCount\n viewsCount\n sessionsCount\n sales {\n amount\n currencyCode\n }\n orders\n firstTimeCustomers\n returningCustomers\n marketingActivity {\n id\n }\n channelHandle\n }\n userErrors {\n field\n message\n }\n }\n}"
input: null
response: { "data": { "marketingEngagementCreate": { "marketingEngagement": { "occurredOn": "2018-06-29", "utcOffset": "-07:00", "isCumulative": false, "adSpend": { "amount": "19.9", "currencyCode": "CAD" }, "clicksCount": 40, "impressionsCount": 100, "commentsCount": 1, "favoritesCount": 0, "unsubscribesCount": 1, "complaintsCount": 1, "failsCount": 1, "sendsCount": 1, "uniqueViewsCount": 1, "uniqueClicksCount": 1, "sharesCount": 5, "viewsCount": 10, "sessionsCount": 40, "sales": { "amount": "304.5", "currencyCode": "CAD" }, "orders": "8.0", "firstTimeCustomers": "5.0", "returningCustomers": "3.0", "marketingActivity": null, "channelHandle": "my-channel-handle" }, "userErrors": [] } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation M($marketingEngagement: MarketingEngagementInput!, $marketingActivityId: ID!) { marketingEngagementCreate(marketingEngagement: $marketingEngagement, marketingActivityId: $marketingActivityId) { marketingEngagement { occurredOn clicksCount commentsCount favoritesCount impressionsCount unsubscribesCount complaintsCount failsCount sendsCount uniqueViewsCount uniqueClicksCount isCumulative fetchedAt utcOffset adSpend { amount currencyCode } marketingActivity { id } } userErrors { field message } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `mutation M($marketingEngagement: MarketingEngagementInput!, $marketingActivityId: ID!) {\n marketingEngagementCreate(marketingEngagement: $marketingEngagement, marketingActivityId: $marketingActivityId) {\n marketingEngagement {\n occurredOn\n clicksCount\n commentsCount\n favoritesCount\n impressionsCount\n unsubscribesCount\n complaintsCount\n failsCount\n sendsCount\n uniqueViewsCount\n uniqueClicksCount\n isCumulative\n fetchedAt\n utcOffset\n adSpend {\n amount\n currencyCode\n }\n marketingActivity {\n id\n }\n }\n userErrors {\n field\n message\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 mutation M($marketingEngagement: MarketingEngagementInput!, $marketingActivityId: ID!) {\n marketingEngagementCreate(marketingEngagement: $marketingEngagement, marketingActivityId: $marketingActivityId) {\n marketingEngagement {\n occurredOn\n clicksCount\n commentsCount\n favoritesCount\n impressionsCount\n unsubscribesCount\n complaintsCount\n failsCount\n sendsCount\n uniqueViewsCount\n uniqueClicksCount\n isCumulative\n fetchedAt\n utcOffset\n adSpend {\n amount\n currencyCode\n }\n marketingActivity {\n id\n }\n }\n userErrors {\n field\n message\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([\"query\" => $query]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation M($marketingEngagement: MarketingEngagementInput!, $marketingActivityId: ID!) {\n marketingEngagementCreate(marketingEngagement: $marketingEngagement, marketingActivityId: $marketingActivityId) {\n marketingEngagement {\n occurredOn\n clicksCount\n commentsCount\n favoritesCount\n impressionsCount\n unsubscribesCount\n complaintsCount\n failsCount\n sendsCount\n uniqueViewsCount\n uniqueClicksCount\n isCumulative\n fetchedAt\n utcOffset\n adSpend {\n amount\n currencyCode\n }\n marketingActivity {\n id\n }\n }\n userErrors {\n field\n message\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "mutation M($marketingEngagement: MarketingEngagementInput!, $marketingActivityId: ID!) {\n marketingEngagementCreate(marketingEngagement: $marketingEngagement, marketingActivityId: $marketingActivityId) {\n marketingEngagement {\n occurredOn\n clicksCount\n commentsCount\n favoritesCount\n impressionsCount\n unsubscribesCount\n complaintsCount\n failsCount\n sendsCount\n uniqueViewsCount\n uniqueClicksCount\n isCumulative\n fetchedAt\n utcOffset\n adSpend {\n amount\n currencyCode\n }\n marketingActivity {\n id\n }\n }\n userErrors {\n field\n message\n }\n }\n}"
input: null
response: { "data": { "marketingEngagementCreate": { "marketingEngagement": { "occurredOn": "2018-06-29", "clicksCount": 40, "commentsCount": 1, "favoritesCount": 0, "impressionsCount": 100, "unsubscribesCount": 1, "complaintsCount": 1, "failsCount": 1, "sendsCount": 1, "uniqueViewsCount": 1, "uniqueClicksCount": 1, "isCumulative": true, "fetchedAt": "2018-06-28T18:32:23Z", "utcOffset": "-07:00", "adSpend": { "amount": "19.9", "currencyCode": "CAD" }, "marketingActivity": { "id": "gid://shopify/MarketingActivity/794355127" } }, "userErrors": [] } } }