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?
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.