I am starting to develop the connection between my system and the one from Exact Target, but having some troubles.

I tried to follow this example, but many functions do not work anymore or are deprecated.

Developing ExactTarget app in JAVA SDK

Can someone provide an updated example on how to insert a new row to a data extension?

Thank you Cheers, Luiz


Below is example of insert new row in DataExtension name "Cocoa" This code is Scala but it's look similar to Java.

val response = client.retrieve(classOf[ETDataExtension], "name = Cocoa")
val de = response.getResult().getObject

val row = new ETDataExtensionRow()
row.setColumn("ID", "1")
row.setColumn("Name", "Coco Nobody0")
row.setColumn("Email", "nb0@agoda.com")

val res = de.insert(row)

The below code will insert new row in DE named 'MyDataExtension' (Subscribers --> Data Extensions). First we filter by the external key. Then we insert the data.

ETFilter etFilter = new ETFilter();
ETExpression etExpression = new ETExpression();

ETResponse<ETDataExtension> dataExtension = client.retrieve(ETDataExtension.class,etFilter);
for (ETDataExtension etDataExtension : dataExtension.getObjects()) {
                " ID:" + etDataExtension.getId() +
                " Key:" + etDataExtension.getKey() +
                " Name:" + etDataExtension.getName()+
                " Description:" + etDataExtension.getDescription() +
                " Create Date:" + etDataExtension.getCreatedDate()+
                " Modified Date:" + etDataExtension.getModifiedDate());
ETDataExtensionRow row = new ETDataExtensionRow();
row.setColumn("Firstname", "XXXXXX");
row.setColumn("EmailAddress", "XXXX@YYYY.com");
ETResponse<ETDataExtensionRow> response = dataExtension.getObjects().get(0).insert(row);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.