// Get DfpUser from "~/dfp.properties".
DfpUser user = new DfpUser();
// Get the ThirdPartySlotService.
ThirdPartySlotServiceInterface thirdPartySlotService =
user.getService(DfpService.V201302.THIRD_PARTY_SLOT_SERVICE);
// Create a statement to get one active third party slot.
Statement filterStatement =
new StatementBuilder("WHERE status = :status LIMIT 1")
.putValue("status", ThirdPartySlotStatus.ACTIVE.toString()).toStatement();
// Get third party slot by statement.
ThirdPartySlotPage page =
thirdPartySlotService.getThirdPartySlotsByStatement(filterStatement);
if (page.getResults() != null) {
ThirdPartySlot[] thirdPartySlots = page.getResults();
// Update each local third party slot by changing its description.
for (ThirdPartySlot thirdPartySlot : thirdPartySlots) {
thirdPartySlot.setDescription("Updated description");
// Update the third party slot on the server.
thirdPartySlot = thirdPartySlotService.updateThirdPartySlot(thirdPartySlot);
// Display results.
if (thirdPartySlot != null) {
System.out.println("A third party slot with ID \"" + thirdPartySlot.getId()
+ "\" and description \"" + thirdPartySlot.getDescription() + "\" was updated.");