This document reflects over the aforementioned use cases of the Events API. All examples defined within demonstrate calls to the SOAP interface and are provided as is.
The following examples demonstrate calls to the Events API in C#. .NET examples demonstrated here assume the use of a generated XML web service client. To generate such a client, a tool such as WSDL.exe can be used. A detailed description on this tool can be found on MSDN, but all you will need to do is point it at your site's WSDL description.
This is an example only. Production code should handle errors.
// Instantiate the webservice proxy
EventAPI service = new EventAPI();
// Authentication details
String username = "TestUser";
String password = "TestPassword";
// Authenticate
ApiResponse authenticationResponse = service.Authenticate(username, password);
string authCode = authenticationResponse.Message;
// Retrieve and print all event types
EventTypeApiResponse eventTypeResponse = service.RetrieveTypes(authCode);
foreach(EventType et in eventTypeResponse.Data) {
Console.WriteLine(et.Type);
}
// Instantiate the webservice proxy
EventAPI service = new EventAPI();
// Authentication details
String username = "TestUser";
String password = "TestPassword";
// Authenticate
ApiResponse authenticationResponse = service.Authenticate(username, password);
string authCode = authenticationResponse.Message;
// Messages to retrieve
SubscriberSequenceMapping[] toRetrieve = new SubscriberSequenceMapping[] {
new SubscriberSequenceMapping() {
SubscriberID = 1,
Sequence = 1
},
new SubscriberSequenceMapping() {
SubscriberID = 1,
Sequence = 2
}
};
// Print types of retrieved messages
EventMessageApiResponse response = service.Retrieve(authCode, toRetrieve);
foreach(EventMessage message in response.Data) {
Console.WriteLine(message.Type);
}