Using the Marketo REST API for Bulk Activity Export

Kevin_Tuttle1
Marketo Employee
Marketo Employee

Has your favorite data analysis tool recently deprecated its connector to Marketo Engage? Worry not, you can use the Marketo REST API yourself to automatically export data from Marketo including data on system and custom Activities.

 

This blog post assumes the reader is already familiar with using the Marketo REST API including setting up a custom service in the LaunchPoint section of the Admin console, and then using those credentials to obtain a Bearer Token with the necessary permissions to use the Bulk Export functionality. Once that is complete, it's a simple 3-step process to get your Activity data exported.

 

  1. Use the Create Export Activity Job endpoint to specify your parameters and get the job setup. You will need to indicate which Activities that you want to export by their ID values. These can be obtained using the Get Lead Activities endpoint and are also contained in this freely-available Google Sheets document. A common use case is to select Activities based on the "created date" of the Activity - basically when it occurred. As Activities are write-once, they don't have "updated dates" as Custom Objects would. Note that the date range here, however, is limited to 30 days. So if you are putting together an automated job, you may want to ensure it runs more frequently than that.

    Sample payload:
    Kevin_Tuttle1_0-1682719216364.png
    This call will return an exportId value that will be used in the next calls so be sure to save it for later.

  2. Enqueue the export job with the appropriately-named Enqueue Export Activity Job endpoint. This actually starts the export process. By default, Marketo Engage instances can only actually have 2 jobs queued at a time so you can use this to make sure your jobs stay under that limit. For this call it's a simple POST to the endpoint with no payload, but the exportId from above added to the URL, e.g.: /rest/bulk/v1/activities/export/(exportId)/enqueue.json.

  3. Once the export is complete, you can retrieve the resultant file with the Get Export Activity File endpoint by replacing "enqueue" above with "file" and using a GET , e.g.: /rest/bulk/v1/activities/export/(exportId)/file.json and you're done!

 

Addenda:

  • While the export process is in progress, you can use the /status.json endpoint as above to see if the export is complete or not. This is especially useful for larger export jobs.
  • Note that all Bulk Export calls share a single bandwidth limit (by default 500 MB/day) on a per-instance basis. This should reset at midnight CST.
2642
0