The following environment settings need to be configured:
*`${SF_USER_NAME}` (`salesforce.username`) - the username configured in Salesforce to utilize
*`${SF_PASSWORD}` (`salesforce.password`) - the password (excluding security token) for the username provided above
*`${SF_CONSUMER_KEY}` (`salesforce.consumer-key`) - the Salesforce Connected App consumer key value (see "Salesforce Connected App" section for more details)
*`${SF_CONSUMER_SECRET}` (`salesforce.consumer-secret`) - the Salesforce Connected App consumer secret value (see "Salesforce Connected App" section for more details)
*`${PORT}` (`server.port`) - port number for Spring Boot service
## Salesforce Connected App
A Connected App in Salesforce is required to allow access to the Salesforce instance. Below, are instructions
which were followed at the time this repository was created:
1. Create a free Developer account at https://developer.salesforce.com/signup
2. Navigate to the *Setup* link
3. Navigate to *Apps | Apps Manager* section on the left-hand menu
4. Select the *New Connected App* button
5. Populate the following properties:
1. Connected App Name
2. API Name (computed value should be fine)
3. Contact Email (your email address)
4. API | Enable OAuth Settings = true
5. Set callback URL to be "https://login.salesforce.com/"
6. Use OAuth scopes "Access and manage your data (api)" and "Perform requests on your behalf at any time (refresh_token, offline_access)" (for now)
7. Use "Relax IP restrictions" (for now)
8. Use "Refresh token is valid until revoked" (for now)
6. Save the new Connected App
7. Navigate to *Security | Network Access*
8. Create a new Trusted IP Range which includes your current IP address
## The Contact API
For this example, only the `Contact` object in Salesforce will be utilized, which will focus on the following attributes:
```java
publicclassContact{
privateStringname;
privateStringtitle;
privateStringdepartment;
privateSalesforceAttributesattributes;
}
publicclassSalesforceAttributes{
privateStringtype;
privateStringurl;
}
```
The following URIs exist with this service:
`GET - /contacts` - returns a list of `Contacts` from Salesforce
`PATCH /contacts/{id}` - performs the necessary updates and returns the updated object
## Caching
This repository employs the very basic `spring-boot-starter-cache` in order to reduce the need to make API calls to Salesforce.
## Additional Information
Made with <spanstyle="color:red;">♥</span> by johnjvester@gmail.com, because I enjoy writing code.