marketing Activity Updatemutation
mutation
2024-10latest
Requires write
access scope.
Updates a marketing activity with the latest information.
Arguments
The Input of the marketing activity.
Was this section helpful?
MarketingActivityUpdatePayload returns
The updated marketing activity.
The redirect path from the embedded editor to the Shopify admin.
The list of errors that occurred from executing the mutation.
Was this section helpful?
Code examples for MUTATION: marketingActivityUpdate
Query Reference for MUTATION: marketingActivityUpdate
"mutation marketingActivityUpdate($input: MarketingActivityUpdateInput!) {\n marketingActivityUpdate(input: $input) {\n marketingActivity {\n # MarketingActivity fields\n }\n redirectPath\n userErrors {\n field\n message\n }\n }\n}"
Input Reference for MUTATION: marketingActivityUpdate
"{\n \"input\": {\n \"budget\": {\n \"budgetType\": \"DAILY\",\n \"total\": {\n \"amount\": \"29.99\",\n \"currencyCode\": \"AED\"\n }\n },\n \"errors\": \"{ \\\"name\\\": \\\"Size\\\", \\\"values\\\": [\\\"M\\\", \\\"L\\\"] }\",\n \"formData\": \"<your-formData>\",\n \"id\": \"gid://shopify/<objectName>/10079785100\",\n \"marketedResources\": [\n \"gid://shopify/<objectName>/10079785100\"\n ],\n \"marketingRecommendationId\": \"gid://shopify/<objectName>/10079785100\",\n \"status\": \"ACTIVE\",\n \"targetStatus\": \"ACTIVE\",\n \"title\": \"<your-title>\",\n \"urlParameterValue\": \"<your-urlParameterValue>\",\n \"utm\": {\n \"campaign\": \"<your-campaign>\",\n \"medium\": \"<your-medium>\",\n \"source\": \"<your-source>\"\n }\n }\n}"
Schema Reference for MUTATION: marketingActivityUpdate
"input MarketingActivityUpdateInput {\n adSpend: MoneyInput\n budget: MarketingActivityBudgetInput\n context: String\n errors: JSON\n formData: String\n id: ID!\n marketedResources: [ID!]\n marketingRecommendationId: ID\n status: MarketingActivityStatus\n targetStatus: MarketingActivityStatus\n title: String\n urlParameterValue: String\n utm: UTMInput\n}\n\ninput MoneyInput {\n amount: Decimal!\n currencyCode: CurrencyCode!\n}\n\ninput MarketingActivityBudgetInput {\n budgetType: MarketingBudgetBudgetType\n total: MoneyInput\n}\n\ninput UTMInput {\n campaign: String!\n medium: String!\n source: String!\n}\n"
Display Examples for MUTATION: marketingActivityUpdate
[ { "example": { "type_name": "marketingactivityupdate", "title": "Sets the budget for the marketing activity", "query_string": "mutation marketingActivityUpdate($id: ID!, $budgetType: MarketingBudgetBudgetType!, $amount: Decimal!, $currencyCode: CurrencyCode!) {\n marketingActivityUpdate(input: {id: $id, budget: {budgetType: $budgetType, total: {amount: $amount, currencyCode: $currencyCode}}}) {\n marketingActivity {\n budget {\n budgetType\n total {\n amount\n currencyCode\n }\n }\n }\n }\n}", "variables": { "id": "gid://shopify/MarketingActivity/794355127", "budgetType": "LIFETIME", "amount": 100, "currencyCode": "CAD" }, "response": { "data": { "marketingActivityUpdate": { "marketingActivity": { "budget": { "budgetType": "LIFETIME", "total": { "amount": "100.0", "currencyCode": "CAD" } } } } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/merchant_marketing/test/unit/graph_api/admin/mutations/marketing_activity_update_test.rb", "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 marketingActivityUpdate($id: ID!, $budgetType: MarketingBudgetBudgetType!, $amount: Decimal!, $currencyCode: CurrencyCode!) { marketingActivityUpdate(input: {id: $id, budget: {budgetType: $budgetType, total: {amount: $amount, currencyCode: $currencyCode}}}) { marketingActivity { budget { budgetType total { amount currencyCode } } } } }\",\n \"variables\": {\n \"id\": \"gid://shopify/MarketingActivity/794355127\",\n \"budgetType\": \"LIFETIME\",\n \"amount\": 100,\n \"currencyCode\": \"CAD\"\n }\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation marketingActivityUpdate($id: ID!, $budgetType: MarketingBudgetBudgetType!, $amount: Decimal!, $currencyCode: CurrencyCode!) {\n marketingActivityUpdate(input: {id: $id, budget: {budgetType: $budgetType, total: {amount: $amount, currencyCode: $currencyCode}}}) {\n marketingActivity {\n budget {\n budgetType\n total {\n amount\n currencyCode\n }\n }\n }\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/MarketingActivity/794355127\",\n \"budgetType\": \"LIFETIME\",\n \"amount\": 100,\n \"currencyCode\": \"CAD\"\n },\n },\n);\n\nconst data = await response.json();\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 marketingActivityUpdate($id: ID!, $budgetType: MarketingBudgetBudgetType!, $amount: Decimal!, $currencyCode: CurrencyCode!) {\n marketingActivityUpdate(input: {id: $id, budget: {budgetType: $budgetType, total: {amount: $amount, currencyCode: $currencyCode}}}) {\n marketingActivity {\n budget {\n budgetType\n total {\n amount\n currencyCode\n }\n }\n }\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/MarketingActivity/794355127\",\n \"budgetType\": \"LIFETIME\",\n \"amount\": 100,\n \"currencyCode\": \"CAD\"\n}\n\nresponse = client.query(query: query, variables: variables)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation marketingActivityUpdate($id: ID!, $budgetType: MarketingBudgetBudgetType!, $amount: Decimal!, $currencyCode: CurrencyCode!) {\n marketingActivityUpdate(input: {id: $id, budget: {budgetType: $budgetType, total: {amount: $amount, currencyCode: $currencyCode}}}) {\n marketingActivity {\n budget {\n budgetType\n total {\n amount\n currencyCode\n }\n }\n }\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/MarketingActivity/794355127\",\n \"budgetType\": \"LIFETIME\",\n \"amount\": 100,\n \"currencyCode\": \"CAD\"\n },\n },\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation marketingActivityUpdate($id: ID!, $budgetType: MarketingBudgetBudgetType!, $amount: Decimal!, $currencyCode: CurrencyCode!) {\n marketingActivityUpdate(input: {id: $id, budget: {budgetType: $budgetType, total: {amount: $amount, currencyCode: $currencyCode}}}) {\n marketingActivity {\n budget {\n budgetType\n total {\n amount\n currencyCode\n }\n }\n }\n }\n }\nQUERY;\n\n$variables = [\n \"id\" => \"gid://shopify/MarketingActivity/794355127\",\n \"budgetType\" => \"LIFETIME\",\n \"amount\" => 100,\n \"currencyCode\" => \"CAD\",\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "variables", "inputVariableEntries": [] }, { "example": { "type_name": "marketingactivityupdate", "title": "Updates a marketing activity into ACTIVE state", "query_string": "mutation marketingActivityUpdate($id: ID!, $status: MarketingActivityStatus!) {\n marketingActivityUpdate(input: {id: $id, status: $status}) {\n marketingActivity {\n id\n title\n status\n }\n }\n}", "variables": { "id": "gid://shopify/MarketingActivity/794355127", "status": "ACTIVE" }, "response": { "data": { "marketingActivityUpdate": { "marketingActivity": { "id": "gid://shopify/MarketingActivity/794355127", "title": "Marketing Activity for Snowdevil", "status": "ACTIVE" } } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/merchant_marketing/test/unit/graph_api/admin/mutations/marketing_activity_update_test.rb", "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 marketingActivityUpdate($id: ID!, $status: MarketingActivityStatus!) { marketingActivityUpdate(input: {id: $id, status: $status}) { marketingActivity { id title status } } }\",\n \"variables\": {\n \"id\": \"gid://shopify/MarketingActivity/794355127\",\n \"status\": \"ACTIVE\"\n }\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation marketingActivityUpdate($id: ID!, $status: MarketingActivityStatus!) {\n marketingActivityUpdate(input: {id: $id, status: $status}) {\n marketingActivity {\n id\n title\n status\n }\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/MarketingActivity/794355127\",\n \"status\": \"ACTIVE\"\n },\n },\n);\n\nconst data = await response.json();\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 marketingActivityUpdate($id: ID!, $status: MarketingActivityStatus!) {\n marketingActivityUpdate(input: {id: $id, status: $status}) {\n marketingActivity {\n id\n title\n status\n }\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/MarketingActivity/794355127\",\n \"status\": \"ACTIVE\"\n}\n\nresponse = client.query(query: query, variables: variables)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation marketingActivityUpdate($id: ID!, $status: MarketingActivityStatus!) {\n marketingActivityUpdate(input: {id: $id, status: $status}) {\n marketingActivity {\n id\n title\n status\n }\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/MarketingActivity/794355127\",\n \"status\": \"ACTIVE\"\n },\n },\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation marketingActivityUpdate($id: ID!, $status: MarketingActivityStatus!) {\n marketingActivityUpdate(input: {id: $id, status: $status}) {\n marketingActivity {\n id\n title\n status\n }\n }\n }\nQUERY;\n\n$variables = [\n \"id\" => \"gid://shopify/MarketingActivity/794355127\",\n \"status\" => \"ACTIVE\",\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "variables", "inputVariableEntries": [] } ]