1

I'm using Python and the associated Fuel SDK package to make API calls to SalesForce Marketing Cloud. I'm attempting to consolidate information from various cloud objects to obtain the same information found in the "My Tracking" portion of the Marketing Cloud site shown here:

enter image description here

My problem is that I'm not sure how to connect the objects I've created within Python to replicate the above. The sent event object I created could get me Job ID, Total Sent and Date Sent. Using a data extensions object could get me Name and Data Extensions, but I can't find a shared object property between the two to help me link them. Is there something I'm missing? Is there maybe some other object I'm supposed to use to get me what I need?

Here are sample responses.

#folder object gets me the 'Name' portion from the image above

[(DataFolder){
   Client = 
      (ClientID){
         ID = a
         ModifiedBy = 6779065
         EnterpriseID = a
      }
   PartnerKey = None
   CreatedDate = 2020-02-11 13:34:00.660000
   ModifiedDate = 2020-02-11 13:34:00.660000
   ID = 124676
   ObjectID = "0846b221-1a51-4548-87ee-7ae16ae3d8ab"
   CustomerKey = None
   ParentFolder = 
      (DataFolder){
         PartnerKey = None
         ID = 60479
         ObjectID = "a387aa5e-daf6-4a5e-b023-e22211ef1a3a"
         CustomerKey = "dataextension_default"
         Name = "Data Extensions"
         Description = None
         ContentType = "dataextension"
         IsActive = True
         IsEditable = False
         AllowChildren = True
      }
   Name = "Y12_Week_7_Email" 
   Description = None
   ContentType = "dataextension"
   IsActive = True
   IsEditable = True
   AllowChildren = True
 }]

#Using the ID from the folder object, I can use it to retrieve the data 
#extensions within the folder to get me 'Data Extensions` from the image above

(DataExtension){
   Client = 
      (ClientID){
         ID = a
      }
   PartnerKey = None
   CreatedDate = 2020-02-11 13:37:34.067000
   ModifiedDate = 2020-02-11 13:37:34.067000
   ObjectID = "389264ef-054d-ea11-a2e8-1402ec94b121"
   CustomerKey = "9209B1FA-E92B-4E2E-AA31-B168BE174BB5"
   Name = "Y12_Week_7_Both"
   Description = None
   CategoryID = 124676
 }

#the sent event object can get me the 'Job ID' using the SendID, but there doesn't appear to be any other info within this object or the other two to help me link this object to the two from before.

(SentEvent){
   Client = 
      (ClientID){
         ID = a
      }
   PartnerKey = None
   PartnerProperties[] = 
      (APIProperty){
         Name = "ListID"
         Value = "132509"
      },
      (APIProperty){
         Name = "SubscriberID"
         Value = "205946194"
      },
   ObjectID = None
   SendID = 4347170
   SubscriberKey = "dummyemail"
   EventDate = 2020-02-11 17:30:46.390000
   EventType = "Sent"
   TriggeredSendDefinitionObjectID = None
   BatchID = 1
 }

1 Answer 1

0

With the help of FuelSDKWrapper package, you can fulfill this requirements. You have to done the followings -

from FuelSDKWrapper import ET_API, ObjectType, Operator, FolderType, simple_filter, complex_filter
from datetime import datetime, timedelta

params = {'clientid':ClientID,
     'clientsecret':ClientSecret,       
     'useOAuth2Authentication': 'True',
     'authenticationurl': auth_base_url,
     'applicationType': 'server',
     'baseapiurl': rest_url,
     'soapendpoint': soap_url,
     'useOAuth2Authentication': 'True',
     'accountId': AccountID}

#get authentication
def get_AuthBy_ET_API():
    #api authentication
    api = ET_API(params=params)
    return api


#authenication 
api=get_AuthBy_ET_API()

#date filter parameter
start_date = datetime.now() - timedelta(days=30)

#authenication
api=get_AuthBy_ET_API()


response = api.get_objects(ObjectType.SEND, 
                       complex_filter(
                           simple_filter("EmailName", Operator.LIKE, "SearchString"),
                           "AND",
                           simple_filter("NumberSent", Operator.GREATER_THAN, "0"))
                      )

#response = api.get_objects(ObjectType.SEND)

# Print out the results for viewing
print('Post Status: {}'.format(response.status))
print('Code: {}'.format(response.code))
print('Message: {}'.format(response.message))
print('More Results: {}'.format(response.more_results))
print('Result Count: {}'.format(len(response.results)))
print('Results: {}'.format(response.results))

Now you have all the required fields.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .