My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
These examples pertain to the 'standard' Eloqua WSDL, which provides functionality for
managing assets, entities, and activities, as well as basic email sending. It does not
currently support the method calls in the WSDLs that are dedicated to handling mass emailing
and data management (bulk importing/exporting).

Eloqua's API does not currently provide anything other than a shell SoapFault in many cases, so the
utility methods to view the most recent SOAP envelope that was sent is quite useful in debugging.

Most calls take an array of entities or assets, and the SDK will throw an exception if an array is
not passed.

NOTE: These examples are not intended to teach the Eloqua API; rather, they are here to
illustrate how the PHP SDK implements the Eloqua API.

Prerequisites
-------------
All examples below assume the SDK has been instantiated.

require_once 'EloquaServiceClient.php';

$eloqua = new EloquaServiceClient('/path/to/wsdl', 'organization_name\username', 'password');

Conventions
-----------
<create entity> - implies that you copy and paste the code from the Create() section, so you have a
Contact in the variable $entity and a CreateResult in the variable $result.

<create asset> - implies that you copy and paste the code from the CreateAsset() section, so you
have an ContactGroup in the variable $asset and a CreateAssetResult in the variable
$result.

Method Names:
-------------
To comply with Eloqua's standards, all SDK method names are uppercase.

Variable Names:
---------------
$eloqua - reference to an instance of the Toolkit object
$result - the result of an Eloqua method call
$entity - an entity object


----------------------------------------------------------------------------------------------------

Entity Metadata Operations:

ListEntityTypes()
-----------------

$result = $eloqua->ListEntityTypes();


DescribeEntityType()
--------------------

$result = $eloqua->DescribeEntityType('Base');


DescribeEntity()
----------------

$result = $eloqua->DescribeEntity(new EntityType(0, 'Contact', 'Base'));


Entity Operations:

Create()
--------

$entity = new DynamicEntity('Contact');
$entity->C_EmailAddress = 'foo@example.com';
$result = $eloqua->Create(array($entity));
$entity->Id = $result->CreateResult->CreateResult->ID;


Retrieve()
----------
$result = $eloqua->Retrieve(new EntityType(0, 'Contact', 'Base'), array(*ID TO RETRIEVE*, *ANOTHER ID*));


Update()
--------
<create entity>
$entity->C_EmailAddress = 'bar@example.com';
$result = $eloqua->Update(array($entity));


Delete()
--------
$result = $eloqua->Delete(new EntityType(0, 'Contact', 'Base'), array(*ID TO DELETE*));


Query()
-------
$result = $eloqua->Query(new EntityType(0, 'Contact', 'Base'), 'C_EmailAddress=\'*@example.com\'');


Asset Metadata Operations:

ListAssetTypes()
----------------
$result = $eloqua->ListAssetTypes();


DescribeAssetType()
-------------------
$result = $eloqua->DescribeAssetType('ContactGroup');


DescribeAsset()
---------------
$assetType = new AssetType(0, 'ContactGroupName', 'ContactGroup');
$result = $eloqua->DescribeAsset($assetType);


Asset Operations:

Create()
--------
$assetType = new AssetType(0, 'ContactGroupName', 'ContactGroup');
$asset = new DynamicAsset($assetType);

$asset->name = 'my group name';
$asset->description = 'my group description';

$result = $eloqua->CreateAsset(array($asset));
$asset->Id = $result->CreateAssetResult->CreateAssetResult->ID;


Retrieve()
----------
$assetType = new AssetType(0, 'ContactGroupName', 'ContactGroup');
$result = $eloqua->RetrieveAsset($assetType, array(*ID TO RETRIEVE*));


Update()
--------
<create asset>
$asset->name = 'my group, renamed';

$result = $eloqua->UpdateAsset(array($asset));


Delete()
--------
$assetType = new AssetType(0, 'ContactGroupName', 'ContactGroup');
$result = $eloqua->DeleteAsset($assetType, array(*ID TO DELETE*));


General API Functions:

ListGroupMembership()
---------------------
$result = $eloqua->Retrieve(new EntityType(0, 'Contact', 'Base'), array(*ENTITY ID*));
$entity = $result[0];
$result = $eloqua->ListGroupMembership($entity);


AddGroupMember()
----------------
$result = $eloqua->Retrieve(new EntityType(0, 'Contact', 'Base'), array(*ENTITY ID*));
$entity = $result[0];
$result = $eloqua->RetrieveAsset(new AssetType(0, 'ContactGroupName', 'ContactGroup'),
array(*ASSET ID*));
$asset = $result[0];

$result = $eloqua->AddGroupMember($entity, $asset);

RemoveGroupMember()
$result = $eloqua->Retrieve(new EntityType(0, 'Contact', 'Base'), array(*ENTITY ID*));
$entity = $result[0];
$result = $eloqua->RetrieveAsset(new AssetType(0, 'ContactGroupName', 'ContactGroup'),
array(*ASSET ID*));
$asset = $result[0];

$result = $eloqua->RemoveGroupMember($entity, $asset);


Undocumented API Functions:

ListActivityTypes()
-------------------
$result = $eloqua->ListActivityTypes();


DescribeActivityType()
----------------------
$result = $eloqua->DescribeActivityType('Web');


DescribeActivity()
------------------
$activity = new EloquaActivityType(null, 'Form', 'FormSubmit');
$result = $eloqua->DescribeActivity($activity);


GetActivities()
---------------
$result = $eloqua->Retrieve(new EntityType(0, 'Contact', 'Base'), array(*ID TO RETRIEVE*));
$entity = $result[0];

$result = $eloqua->GetActivities($entity, array('FormSubmit', 'WebVisit'), '2008-10-13T09:59:00Z', '2010-10-13T09:59:00Z');


GetEmailActivitiesForRecipients()
---------------------------------
// This friend of mine brought three chickens into his high school as a prank.
// They were wearing numbers - 1, 2, and 4.
// So, in his honor...
$result = $eloqua->GetEmailActivitiesForRecipients(array('foo@example.com'), array(1, 2, 4)); // 1, 2, 4 are IDs of emails


SendQuickEmail()
----------------
$result = $eloqua->Retrieve(new EntityType(0, 'Contact', 'Base'), array(*ID TO RETREIVE*));
$entity = $result[0];
$result = $eloqua->RetrieveAsset(new AssetType(0, '*NAME OF EMAIL*', 'Email'), array(*ASSET ID*));
$asset = $result[0];

$options = array('AllowResend' => true);
$result = $eloqua->SendQuickEmail($asset, $entity, $options);


GetQuickEmailStatus()
---------------------
$result = $eloqua->GetQuickEmailStatus(*PUT deploymentId FROM $result OF SendQuickEmail() HERE*);

Change log

r3 by dlanstein on May 26, 2010   Diff
fixed svn paths
Go to: 
Project members, sign in to write a code review

Older revisions

r2 by dlanstein on May 26, 2010   Diff
initial commit
All revisions of this file

File info

Size: 6367 bytes, 226 lines
Powered by Google Project Hosting