AmericaSCORESBayArea/salesforce-data-api
This project is based on Mulesoft Dataweave and Salesforce to provide secure, reliable, API access for all the Scores apps and projects. It is hosted on Anypoint and acts as the transactional hub, in concert with the authentication API
salesforce-data-api ๐ก
Our core Mulesoft app was built to interact with Scores data in Salesforce database. In a few words, is a RESTful API server that allows us to perform CRUD operations on Salesforce objects. Yet we extend its functionality!
๐บ Postman Collection (API Documentation)
Development and Testing the app
For development and testing purposes, we have 2 IDEs:
- Anypoint Code Builder (based on VS Code)
- Anypoint Studio (based on Eclipse)
Code Builder is supposed to replace the Studio IDE, but it is still missing some functionality that would make development simpler. For small fixes, we use Code Builder. For adding new flows or introducing major changes, we use Anypoint Studio. Since anything can be achieved in either IDE, setting up just one should be sufficient.
Note: Code Builder offers both local and cloud-based versions.
Anypoint Code Builder Setup (based on local version)
- Download VS Code
- Install Mulesoft Extenssion Pack
- Clone the repository and open the folder
- Create
local.propertiesfile in thesrc/main/resources/propertiesfolder (reach out to someone from America SCORES to get Sandbox properties):
http.listener.host=0.0.0.0
http.listener.port=8091
fullDomain=0.0.0.0:8091
api.id=
keystore.key.password=
keystore.password=
sfdc.user=
sfdc.url=
sfdc.tkn=
sfdc.password=
typeform.clientid=
typeform.clientsecret=
typeform.tkn=
slack.enabled=
slack.client_id=
slack.client_secret= - Configure Runtime
- Add
-M-Denv=local,-Duser.timezone=UTCand-M-Danypoint.platform.gatekeeper=disabledto Default Runtime Arguments - Select Mule and Java versions
(click on any xml file insrc/main/mule-> "Set Versions" button should appear; if not, right-click on any xml file insrc/main/muleand selectProject Properties). At the moment, we use Mule 4.6.X and Java 17
- Install Java seperately (depends on the system, visit https://www.java.com)
- Using terminal, generate the a new key pair (public and private keys) and a self-signed certificate (required for HTTPS, even for local) AND move it to
./src/main/resourcesfolder:
keytool -genkeypair -keystore keystore.jks \
-dname "CN=localhost, OU=Unknown, O=America SCORES Bay Area, L=San Francisco, ST=California, C=US" \
-keypass $YOUR_KEYPASS_PASSWORD$ \
-storepass $YOUR_STOREPASS_PASSWORD$ \
-keyalg RSA \
-sigalg SHA256withRSA \
-keysize 2048 \
-alias mule \
-ext SAN=DNS:localhost,IP:127.0.0.1 \
-validity 9999
mv keystore.jks `/src/main/resources`
-
Add
$YOUR_KEYPASS_PASSWORD$and$YOUR_STOREPASS_PASSWORD$to thelocal.propertiesfile intokeystore.key.passwordand
keystore.passwordfields -
Run the project using VS Code Start button (
Debug Mule Application). Ta-da! ๐
โ๏ธ What if I want to run a cloud instance?
- Create Anypoint Platform Account
- Go to the main dashboard
- Under "Anypoint Code Builder", click
Get Startedbutton - Accept the terms and conditions (if you agree)
- Click
Launchbutton (if it's greyed out, refresh the page and wait) - Wait for the environment to get allocated and load. The first time it might take a while
Anypoint Studio Project Setup Guide
Follow the steps below to set up and run the salesforce-data-api MuleSoft project in Anypoint Studio.
๐ 1. Download Anypoint Studio
Download and install Anypoint Studio from the official site:
๐ Anypoint Studio
๐งฌ 2. Clone the Repository
Clone the repository:
salesforce-data-api
๐ 3. Switch to Mule Perspective
Click on the Mule Perspective icon (next to Git) to switch your view for Mule development.
๐ 4. Create local.properties File
Create a file named local.properties inside:
src/main/resources/properties/
Add the following configuration (get sandbox credentials from America SCORES team):
http.listener.host=0.0.0.0
http.listener.port=8091
fullDomain=0.0.0.0:8091
api.id=
keystore.key.password=
keystore.password=
sfdc.user=
sfdc.url=
sfdc.tkn=
sfdc.password=
typeform.clientid=
typeform.clientsecret=
typeform.tkn=
slack.enabled=
slack.client_id=
slack.client_secret= โ๏ธ 5. Configure Mule Runtime
-
Right-click the project โ
Run AsโRun Configurations... -
Create a new config under Mule Applications
-
Set project to launch:
salesforce-data-api -
Scroll down and click Install Runtime
- Select and install:
Mule Server 4.6.X - Restart Studio if prompted
- Select and install:
-
Select the installed Mule Server 4.6.X
-
Click Apply
Add VM Arguments (under Arguments tab):
-M-Denv=local
-Duser.timezone=UTC
-M-Danypoint.platform.gatekeeper=disabled
Set Java Version (under JRE tab):
- Ensure Java 11 or 17+ is selected
Click Apply and close the config window.
โ 6. Verify Runtime & Java Versions
- Mule Runtime: 4.6.X
- Java: 11 or 17+
If the Mule runtime is not 4.6.x, you can install the correct version during step 5.
๐ 7. Install Java (if not present)
Install Java from the official site:
๐ https://www.java.com/
๐๏ธ 8. Generate Keystore and Certificate
Use your terminal or CMD to run the following command in the project root directory:
keytool -genkeypair -keystore keystore.jks \
-dname "CN=localhost, OU=Unknown, O=America SCORES Bay Area, L=San Francisco, ST=California, C=US" \
-keypass YOUR_KEYPASS_PASSWORD \
-storepass YOUR_STOREPASS_PASSWORD \
-keyalg RSA \
-sigalg SHA256withRSA \
-keysize 2048 \
-alias mule \
-ext SAN=DNS:localhost,IP:127.0.0.1 \
-validity 9999Then move the file:
mv keystore.jks src/main/resources/๐ฉ If
keytoolfails, your Java setup may be incorrect. EnsureJAVA_HOMEis set and Java is in the system path.
๐ 9. Add Keystore Passwords
In your local.properties file, add:
keystore.key.password=YOUR_KEYPASS_PASSWORD
keystore.password=YOUR_STOREPASS_PASSWORDClick the Run or Debug button in Anypoint Studio and let the app deploy ๐


