From 2b142c11a67710b7fe99d4ff1a643ab80aad9020 Mon Sep 17 00:00:00 2001 From: tzmfreedom Date: Sat, 9 Jan 2016 11:13:18 +0900 Subject: [PATCH] Add ET_InteractionEvents and sample code --- FuelSDK/objects.py | 14 +++++++++++++- objsamples/sample_interaction.py | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 objsamples/sample_interaction.py diff --git a/FuelSDK/objects.py b/FuelSDK/objects.py index 895ef1a..edf3fe5 100644 --- a/FuelSDK/objects.py +++ b/FuelSDK/objects.py @@ -71,7 +71,19 @@ def __init__(self): self.endpoint = 'https://www.exacttargetapis.com/hub/v1/campaigns/{id}/assets/{assetId}' self.urlProps = ["id", "assetId"] self.urlPropsRequired = ["id"] - + +######## +## +## wrap an Exact Target Interaction Events +## +######## +class ET_InteractionEvents(ET_CUDSupportRest): + def __init__(self): + super(ET_InteractionEvents, self).__init__() + self.endpoint = 'https://www.exacttargetapis.com/interaction/v1/events' + self.urlProps = [] + self.urlPropsRequired = [] + ######## ## ## wrap an Exact Target Click Event diff --git a/objsamples/sample_interaction.py b/objsamples/sample_interaction.py new file mode 100644 index 0000000..13f581a --- /dev/null +++ b/objsamples/sample_interaction.py @@ -0,0 +1,32 @@ +import ET_Client + +try: + debug = False + stubObj = ET_Client.ET_Client(False, debug) + + # In order for this sample to run, it needs to have a interaction. + SubscriberKey = "123456789" + EventDefinitionKey = "ContactEvent-xxxxxxxx" + + # Event Fire for interaction + print '>>> Event Fire for interaction' + postInteractionEvent = ET_Client.ET_InteractionEvents() + postInteractionEvent.auth_stub = stubObj + postInteractionEvent.props = { + "ContactKey": SubscriberKey, + "EventDefinitionKey": EventDefinitionKey, + "Data": { + "Id":"01234567", + "Foo":"Bar" + } + } + postInteractionEventResponse = postInteractionEvent.post() + + print 'PostRequest Status: ' + str(postInteractionEventResponse.status) + print 'Code: ' + str(postInteractionEventResponse.code) + print 'eventInstanceId: ' + str(postInteractionEventResponse.results['eventInstanceId']) + print '-----------------------------' + +except Exception as e: + print 'Caught exception: ' + e.message + print e \ No newline at end of file