jump to navigation

It’s been awhile… July 25, 2008

Posted by mmoriar1 in Uncategorized.
trackback

It’s been about 3 weeks since my last post.  I’ve been slacking in the documentation part of my project I suppose.  Oops 🙂

I’ve done a whole lot in the past 3 weeks, as expected of me.  What I’ve done is implement pages for Triggered Send Definition CRUD (Create Retrieve Update Delete), Triggered Send Definition Tracking data retrieval, ListSubscriber Retrieval, ImportDefinition Creation and Perform, EmailSendDefinition Creation and Perform, List CRUD, Group RUD, Data Extension CD, to name a few.

What I’ll go over in this post is a few nuances which, if known, will help coding the above Web Services calls.

  • Caveats of sending a triggered send via Web Services
  • Retrieving Triggered Send Definitions
  • How to use ListSubscriber to get subs on a list or lists for a sub
  • Details around the DataExtensionObject

One major caveat of sending a triggered send through Web Services is that you must make sure that the subscriber’s required attributes are populated prior to sending a triggered send to said subscriber.  for example, if Last Name was a required subscriber attribute, and I tried to send to a subscriber without a last name attribute being populated, I would get the error: “Unable to queue Triggered Send request.  There are no valid subscribers.”

Another big caveat that is mostly common sense is that if AutoAddSubscribers and/or AutoUpdatesubscribers is/are equal to true then the TriggeredSendDefinition List must be set to a valid List.  This is so that the subscriber can be added/updated on a list if desired.

When retrieving Triggered Send Definitions (as well as a few other objects like Import Definitions, etc.) deleted triggered sends will be retrieved.  This is because, although they are labeled as Deleted in the ExactTarget system, they are still IN the system and will be retrieved as such.  You won’t be able to send or modify the Definition (or other object) in any way, but nonetheless it is there and might confuse someone who doesn’t expect to see a deleted TSD in their list of Definitions.

Working with ListSubscriber objects is pretty straightforward.  Below are two code snippets that are fairly useful:

Get all lists that a subscriber is on:

String usermm = Session[“Curr_User_Name”].ToString();
String mmpass = Session[“Curr_User_Pass”].ToString();
PartnerAPIWse integrationFramework = CreatePartnerAPI(usermm, mmpass);

SimpleFilterPart sfp = new SimpleFilterPart();
sfp.Property = “SubscriberKey”;
sfp.SimpleOperator = SimpleOperators.equals;
sfp.Value = new string[] { “SubscriberKey” }; //put the desired subkey here

RetrieveRequest listsub_request = new RetrieveRequest();
listsub_request.ObjectType = “ListSubscriber”;
listsub_request.Filter = sfp;

string[] ls_props = new string[] { “ListID”, “SubscriberKey”, “Status” };

listsub_request.Properties = ls_props;

APIObject[] results;
string status = “”;
string requestID = “”;
status = integrationFramework.Retrieve(listsub_request, out requestID, out results);

Get all subscribers on a list:

String usermm = Session[“Curr_User_Name”].ToString();
String mmpass = Session[“Curr_User_Pass”].ToString();
PartnerAPIWse integrationFramework = CreatePartnerAPI(usermm, mmpass);

SimpleFilterPart sfp = new SimpleFilterPart();
sfp.Property = “ListID”;
sfp.SimpleOperator = SimpleOperators.equals;
sfp.Value = new string[] { “1234” }; //put the desired listid here

RetrieveRequest listsub_request = new RetrieveRequest();
listsub_request.ObjectType = “ListSubscriber”;
listsub_request.Filter = sfp;

string[] ls_props = new string[] { “Status”, “SubscriberKey”, “ListID” };

listsub_request.Properties = ls_props;

APIObject[] results;
string status = “”;
string requestID = “”;
status = integrationFramework.Retrieve(listsub_request, out requestID, out results);

Finally, I’ve been able to Create (but not successfully delete yet, more details to come) DataExtensionObjects.  DataExtensionObjects correspond to individual records in a Data Extension table.  Here is some sample code on how to do this:

// Instantiate the API
String usermm = Session[“Curr_User_Name”].ToString();
String mmpass = Session[“Curr_User_Pass”].ToString();
PartnerAPIWse integrationFramework = CreatePartnerAPI(usermm, mmpass);

DataExtensionObject deo = new DataExtensionObject();
deo.Name = “Name”; //the name of the data extension
deo.CustomerKey = “Key”; //the external key of the data extension

deo.Properties = new APIProperty[numFields]; //numfields is the number of fields which exist in the data extension
for (int i = 0; i < numFields; i++)
{
deo.Properties[i] = new APIProperty();
deo.Properties[i].Name = “Name”; //enter the name of the field here
deo.Properties[i].Value = “Value”; // enter the desired value for the field here
}

string status = “”;
string requestID = “”;
CreateResult[] results = integrationFramework.Create(new CreateOptions(), new APIObject[] { deo }, out requestID, out status);

I’m going to start documenting a lot more soon, expect more frequent updates once my coding starts to slow up.

Thanks,

Michael

Advertisements

Comments»

1. Patrick - July 28, 2010

If you are unable to delete, I may have the solution to your problem. For deleting a DataExtensionObject you must set the deo.Keys property to the APIObject[] that you would normally put in the deo.Properties property. Doesn’t make much sense, but it works.

Thanks,

Patrick

mmoriar1 - December 24, 2010

Hey Patrick!

Deleting is supported now, that was added a few released ago 🙂

Creative workaround though!

Thanks!
-mm


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: