Anchor to marketingActivitiesDeleteAllExternalmarketing
marketingActivitiesDeleteAllExternal
mutation
Requires access scope.
Deletes all external marketing activities. Deletion is performed by a background job, as it may take a bit of time to complete if a large number of activities are to be deleted. Attempting to create or modify external activities before the job has completed will result in the create/update/upsert mutation returning an error.
Anchor to MarketingActivitiesDeleteAllExternalPayload returnsMarketingActivitiesDeleteAllExternalPayload returns
- •
The asynchronous job that performs the deletion. The status of the job may be used to determine when it's safe again to create new activities.
- Anchor to userErrorsuser•
Errors [MarketingActivity non-nullUser Error!]! The list of errors that occurred from executing the mutation.
Was this section helpful?
- Enqueues a job to delete all external activities
- marketingActivitiesDeleteAllExternal reference
Examples
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation marketingActivitiesDeleteAllExternal {
marketingActivitiesDeleteAllExternal {
job {
id
}
}
}`,
);
const data = await response.json();
mutation marketingActivitiesDeleteAllExternal {
marketingActivitiesDeleteAllExternal {
job {
id
}
}
}
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": "mutation marketingActivitiesDeleteAllExternal { marketingActivitiesDeleteAllExternal { job { id } } }"
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation marketingActivitiesDeleteAllExternal {
marketingActivitiesDeleteAllExternal {
job {
id
}
}
}`,
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: `mutation marketingActivitiesDeleteAllExternal {
marketingActivitiesDeleteAllExternal {
job {
id
}
}
}`,
});
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
mutation marketingActivitiesDeleteAllExternal {
marketingActivitiesDeleteAllExternal {
job {
id
}
}
}
QUERY
response = client.query(query: query)
Response
JSON{
"marketingActivitiesDeleteAllExternal": {
"job": {
"id": "gid://shopify/Job/d778213f-460c-467c-b35b-f040b7812c82"
}
}
}