Perform a Query Activity

This page contains information about performing an SQL query activity using the SOAP API.

Why Perform a Query Activity

You can use the SOAP API to perform existing query activities and return any data the activity may return. You must create the query activity in Marketing Cloud before you can use the API to perform the activity. Note that you must use the ObjectID for the query definition (which you can find by performing a retrieve on the QueryDefinition object) when performing that query definition.

How to Perform SQL Queries

Identify your query activity with the specified ObjectID. Use the sample code below as a model for your own code:

Sample SOAP Request - Performing a Query Activity

Sample SOAP Response - Performing a Query Activity

Sample SOAP Envelope - Checking the Status of the Query Activity Asynchronous Result

The response to your request includes the TaskID, which you can use as a filter with the AsyncActivityStatus object to retrieve the status of the query activity.

Query Activity