Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

forcedotcom/salesforce-datacom-api-java-client

Salesforce Data.com Java REST API

================================

Think the REST API is awesome and powerful, but maybe a bit overwhelming? This native Java implementation aims to keep the implementation simple while keeping all the power at your fingertips.

Overview

This Java REST API is a simple library to interact with the REST API.

Usage

Simply clone the salesforce-datacom-api-java-client project and incorporate it into your project.

Compiling the source is easy using maven:

mvn clean install

The jar file can be found at target/salesforce-datacom-api-java-client-xx.xx.jar.

Features

  • Contact get
  • Contact purchase
  • Contact search

Configuration and authentication

The Java REST API supports only one forms of authentication.

Username and password

If your org allows it (grant_type=password), you can use the client ID, client Secret and your username and password to authenticate. This is discouraged and the ClientSecret authentication is preferred over this one.

Example of a configuration file/class to be used with Password authentication

private static final Map<String, String> config = new HashMap<String, String>(){
    {
        put("grant_type", "password");

        put("username", "myApiUser@myorganisation.com");
        put("password", "myPassword");
        put("client_id", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
        put("x-ddc-client-id", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
    }
};

Examples

You can find loads of practical examples in the test/integration/src/ folder under the com.salesforce.package. For example: TestPost.java

Contact get

A very simple example:

ServiceFactory factory = new ServiceFactoryImpl(config);

ContactService service = factory.createContactService();
List<Contact> contacts = service.get(Arrays.asList(17892515L));

or

ContactService service = new ContactServiceImpl(config);
List<Contact> contacts = service.get(Arrays.asList(17892515L));

This contains almost all information you need.

Contact purchase

A very simple example:

ServiceFactory factory = new ServiceFactoryImpl(config);

ContactService service = factory.createContactService();
List<Contact> contacts = service.purchase(Arrays.asList(17892515L));

or

ContactService service = new ContactServiceImpl(config);
List<Contact> contacts = service.purchase(Arrays.asList(17892515L));

This contains almost all information you need.

Contact search

A very simple example:

ServiceFactory factory = new ServiceFactoryImpl(config);

ContactService service = factory.createContactService();

ContactQuery query = new ContactQuery();
query.setLastName("Ashley");
        
SearchContacts contacts = service.search(query);

or

ContactService service = new ContactServiceImpl(config);

ContactQuery query = new ContactQuery();
query.setLastName("Ashley");
        
SearchContacts contacts = service.search(query);

This contains almost all information you need.

License

The BSD 2-Clause License

http://opensource.org/licenses/BSD-2-Clause

See LICENSE.txt

githalytics.com alpha

About

Easy-to-use and efficient Java client library for accessing Data.com APIs using JSON[XML] and OAuth 2.0

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages