================================
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.
This Java REST API is a simple library to interact with the REST API.
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.
- Contact get
- Contact purchase
- Contact search
The Java REST API supports only one forms of authentication.
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.
private static final Map<String, String> config = new HashMap<String, String>(){
{
put("grant_type", "password");
put("username", "[email protected]");
put("password", "myPassword");
put("client_id", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
put("x-ddc-client-id", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
}
};
You can find loads of practical examples in the test/integration/src/ folder under the com.salesforce.package. For example: TestPost.java
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.
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.
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.
The BSD 2-Clause License
http://opensource.org/licenses/BSD-2-Clause
See LICENSE.txt