I am newbie to ExactTarget app development. I'm trying to build an app using Java SDK but I couldn't find any sample code to begin with. Can anyone provide me sample Java code for ExactTarget app development?
-
Hi Manoj.Can you provide more details on what you are trying to do? -ian– Ian MurdockCommented May 1, 2014 at 12:25
-
@IanMurdock I have requirement to build an app for a company some thing like inventory ...Since im very new to this ET development and i Know oly java...I dont know from where to begin ...thts y i need help from some ultra ET specialist like you :-)– Manoj ChandranCommented May 2, 2014 at 10:10
Add a comment
|
1 Answer
It depends on what you are trying to do. In general, to use the SDK, you need to get a client ID and secret from App Center on Code@ExactTarget, instantiate an ETClient
object with that client ID and secret, then use that instance as the authentication context for future interactions. For example, here is how you retrieve a data extension and add a row to it:
// specifiy client ID and secret
ETConfiguration configuration = new ETConfiguration();
configuration.setClientId(YOUR_CLIENT_ID_GOES_HERE);
configuration.setClientSecret(YOUR_CLIENT_SECRET_GOES_HERE);
// instantiate ETClient object
ETClient client = new ETClient(configuration);
// retrieve the data extension "products"
ETFilter filter = new ETSimpleFilter("Name",
ETFilterOperators.EQUALS,
"products");
ETDataExtension dataExtension = client.retrieveDataExtension(filter);
// add a row to the data extension "products"
ETDataExtensionRow row = new ETDataExtensionRow();
row.setColumn("id", "123");
row.setColumn("name", "My Great Product");
row.setColumn("price", "42.00");
dataExtension.insert(row);
As Ivan mentions, you can also use the raw API in Java as well.