Step-By-Step Guide to Get Started with Salesforce REST API using Java

(IMPORTANT: This is an old blog post that shows how to execute java program from Eclipse IDE. If you would rather prefer to execute java program from VS Code, plesae navigate to this blog post instead) 

How do you connect to Salesforce from an external application, say, for example Java? If you Google for the information, you will quickly learn that Salesforce provides different methods and different APIs. But what you will probably not find is a step-by-step guide teaching you exactly how to do it. In this blog post, I have stitched together a complete step-by-step instructions with screenshots on how to download, install, configure and use Salesforce REST API to connect from a java program and execute some basic transactions (query, insert, update, delete records). In less than 45 minutes, you will have a fully functional java program that will connect to Salesforce and execute transactions in Salesforce.

The guide includes downloading & installing necessary HttpClient and JSON frameworks that is required to work with Salesforce REST APIs. This is followed by referencing the JAR file in your java program, logging on to Salesforce from the java program, querying and manipulating data. Here is an overview of steps that needs to be completed and is covered in the guide

    • Install Java
    • Install Eclipse
    • Install HttpClient
    • Install JSON Framework
    • Create Connected Apps in Salesforce
    • Setup REST Environment in Java
    • Create Java Program
    • Execute Transactions using REST API

(Once you are done with this, you may also want to explore my other blog post Step-By-Step Guide to Get Started with Salesforce SOAP API using Java to learn how to get started with Salesforce SOAP API using Java or explore A 60 Minutes Step-By-Step DIY Guide to Salesforce REST API for Non-Developers to get started with REST API without going through the hassles of writing a Java program )

Even if you are not a developer, you should be able to follow the guide and have working java program at the end of it.  Sounds interesting? Download the following presentation and let’s get started…

To download a PDF copy of the presentation above

check to receive weekly updates on more of such awesome guides

(You'll never be spammed on my watch. And that's a promise)
Liked this guide? We are now also offering a complete course on Mastering Salesforce APIs. This is a training course designed for all Salesforce Professionals (Admins, Consultants, Developers & Architects) to understand how Salesforce APIs work. For more details please click here.

Here is the URL to get the code used in this guide

  1. Java program to connect to test connecting to Salesforce 
  2. Java program to query, create, update & delete records in Salesforce

Not only this, you can go a step further and use other RESTful APIs that Salesforce provides to extract and manipulate data and metadata. For a list of different APIs along with a brief explanation on which API should be used when, please navigate to URL

Other References:

  1. Salesforce REST API Developer Guide –
  2. Setting Up Your Java Developer Environment –