[SalesForce] Bulk Retreive: Rest API – SF Marketing Cloud

I need to pull various data from Salesforce Marketing Cloud (ExactTarget) including subscriber information, last open, last click, success rate (opens/total eligible campaigns), first bounce date, and first unsubscribed date.

As these metrics will require retrieving all data from at least 4 objects (likely more than 4), I need to find a way to get all the needed data while staying within my 50,000 allotted API requests.

All data will be loaded historically upon first execution. Daily executions will commence, getting only new or updated data.

Is there anyway of accomplishing this? Preferably with their REST API.

I'm opting for the raw REST API (over the FuelSDKs) via Python due to the inactivity of the opensource community.

Best Answer

You can certainly retrieve this information using the Marketing Cloud Fuel API, but at this time, you can only POST and PUT into Data Extensions using the REST API (refer to the Data Events methods), so you will have to use the SOAP API for now.

Here's a typical SOAP request envelope to retrieve data from a Data Extension:

<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Header>
      <fueloauth xmlns="http://exacttarget.com">InsertOAuthAccessTokenHere</fueloauth>
   </soapenv:Header>
   <soapenv:Body>
      <RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
         <RetrieveRequest>
            <ObjectType>DataExtensionObject[InsertDataExtensionExternalKeyHere]</ObjectType>
            <Properties>firstname</Properties>
            <Properties>lastname</Properties>
            <Properties>email</Properties>
            <Filter xsi:type="SimpleFilterPart">
                <Property>memberno</Property>
                <SimpleOperator>equals</SimpleOperator>
                <Value>123456</Value>
            </Filter>
         </RetrieveRequest>
      </RetrieveRequestMsg>
   </soapenv:Body>
</soapenv:Envelope>

Regarding tracking data (click, open, etc), you will need to create a Query Activity that uses a Data View, then you can create an Automation to run the Query Activity at a regular schedule.

Regarding your "50,000 allotted API requests", this is a soft-cap — you can make more requests than 50,000. There are no physical restrictions in place, although Marketing Cloud could implement them if the number of requests are too excessive.

Related Topic