Quantcast
Channel: Topliners : All Content - All Communities
Viewing all articles
Browse latest Browse all 3420

Bulk API - Java SDK

$
0
0

Attention developers - the results of our poll (Let's write some code together) are in and a majority of people are looking for Java! We're excited to announce that we've started a Java SDK project to help developers building on the Bulk API. The project is open source and currently supports the following operations :

  • Contact Exports
  • Contact Imports
  • Custom Object Exports
  • Custom Object Imports
  • Account Exports
  • Account Imports

 

Grab a copy from Github and check for updates.

 

Create Client

AccountInfo info = BulkClient.GetAccountInfo("site", "user", "password");
BulkClient client = new BulkClient("site", "user", "password", info.urls.apis.rest.bulk);

 

Search

SearchResponse<Field> fields = client.ContactFieldClient().Search(searchTerm, page, count);

 

 

Contact Export

// instantiate a new instance of the client
// String baseUrl = BulkClient.GetAccountInfo(site, user, password);
BulkClient client = new BulkClient("site", "user", "password", "https://secure.eloqua.com/API/Bulk/1.0");

// define the list of fields to be included in the Export
// use : client.ContactFieldClient().Search(searchTerm, page, pageSize)
HashMap<String, String> fields = new HashMap<String, String>();
fields.put("C_EmailAddress", "{{Contact.Field(C_EmailAddress)}}");
fields.put("C_FirstName", "{{Contact.Field(C_FirstName)}}");

// define the filter criteria for the export
// use : client.ContactFilterClient().Search(searchTerm, page, pageSize)
ExportFilter filter = new ExportFilter();
filter.filterRule = FilterRuleType.member;
filter.membershipUri = "/contact/segment/4268";

// create the definition for the Export
Export export = new Export();
export.name = "sample export";
export.fields = fields;
export.filter = filter;
export.secondsToAutoDelete = 3600;
export.secondsToRetainData = 3600;

Export exportResult = client.ContactExportClient().CreateExport(export);

// create the sync for the Export
Sync sync = new Sync();
sync.status = SyncStatusType.pending;
sync.syncedInstanceUri = exportResult.uri;

// check Sync results (use polling)
Sync syncResult = client.ContactExportClient().CreateSync(sync);

// retrieve the data
Data data = client.ContactExportClient().GetExportData(exportResult.uri);



 

Response

A sample response for this call :

{  "values": [    {      "C_FirstName": "Fred",      "C_EmailAddress": "fred.sakr@oracle.com"    },    {      "C_FirstName": "T.J.",      "C_EmailAddress": "tj.fields@oracle.com"    },    {      "C_FirstName": "Modern",      "C_EmailAddress": "modern.mark@e..."    ..}  ]
}

 

 

The Winter release is scheduled to include support for Exporting Activity Data and we'll aim to have it supported by this client on Day 1.

 

Please note that these libraries are not written or supported by Eloqua. Questions about these libraries can be directed to the author on Github or here on Topliners.

We hope that you find this helpful and please let us know if you have any questions.

 

Thanks,

Fred


Viewing all articles
Browse latest Browse all 3420

Trending Articles