#### Setup vars for creating import/export defs

cdoID = elq.GetCdoId(cdoName='Contacts.LeadType')

myFilter = "'{{CustomObject[1269].Field[23345]}}' = 'GET CAMPAIGN DETAILS'"

findFields = [
    "Contacts.LeadType.MostRecent_Offer_PrimarySolution",
    "Contacts.LeadType.MostRecent_Offer_ProductService",
    "Contacts.LeadType.MostRecent_OfferID", "Contacts.LeadType.S_Data_Status",
    "Contacts.LeadType.S_Last_Error", "Email_Address1"
]

myFields = elq.CreateFieldStatement(entity='customObjects',
                                    cdoID=cdoID,
                                    fields=findFields)

## Do the thing
logging.info("Begin checking for records with 'GET CAMPAIGN DETAILS TEST'")

exportDefName = 'Contacts.LeadType - Get Campaign Details ' + str(
    datetime.now())

cdoDef = elq.CreateDef(defType='exports',
                       entity='customObjects',
                       cdoID=1269,
                       fields=myFields,
                       filters=myFilter,
                       defName=exportDefName)
logging.info("export definition created: " + cdoDef['uri'])
Ejemplo n.º 2
0
from pyeloqua import Eloqua  ## for working with Eloqua's Bulk API

print("try to connect...")
elq = Eloqua(company='mycompany',
             username='******',
             password='******')

print("Eloqua Site ID: " + elq.siteId)  ## outputs your Eloqua instance Site ID
print("Eloqua User: "******"Connected!")

print("Create a field statement for the API")
findTheseFields = ['Email Address', 'Zip or Postal Code'
                   ]  ## a list of fields we want from Eloqua
myFields = elq.CreateFieldStatement(entity='contacts',
                                    fields=findTheseFields,
                                    useInternalName=False)
print(myFields)

print("Create a filter for the API")
myFilter = elq.FilterExists(name='My Zipcodes to clean',
                            existsType='ContactSegment')
print(myFilter)

print("Tell the API what we want to export")
myExport = elq.CreateDef(entity='contacts',
                         defType='exports',
                         fields=myFields,
                         filters=myFilter,
                         defName="My zipcode export")
print("Start syncing the data for export")