Sub topic 1
The Salesforce API landscape at a glance
Salesforce exposes many APIs, and each one targets a different job. This chapter gives you a map of them. Later chapters cover authentication, queries, and each API in detail.
Prerequisites
This chapter assumes you have:
- A basic understanding of HTTP, JSON, and REST concepts.
- Familiarity with Salesforce objects, fields, and records.
- Basic SQL-style querying skills.
- The ability to read simple Apex or JavaScript code.
Why there is more than one API
Salesforce has added APIs over two decades, and each answers a different need. Some move records. Some deploy configuration. Some push change notifications. Picking the wrong one causes wasted API calls, slow jobs, or code that is hard to maintain.
Most Salesforce APIs are versioned. The version number appears in the URL, for example /services/data/v60.0/. You can list the versions your org supports with a plain request:
curl "https://MyDomain.my.salesforce.com/services/data/" \
-H "Authorization: Bearer $ACCESS_TOKEN"The main groups
The APIs fall into four groups by purpose.
- Record access (data APIs): read and write records in standard and custom objects.
- Bulk movement: load or extract very large volumes asynchronously.
- Event-driven: deliver notifications when something happens, so clients do not poll.
- Metadata and development: manage configuration and code, not business records.
Each API in one line
| API | Designed for |
|---|---|
| REST API | General record access over HTTP and JSON. The usual default. |
| SOAP API | The same kind of record access using XML and a WSDL contract. Common in older enterprise tools. |
| Bulk API 2.0 | Asynchronous loads and extracts of large data sets. |
| GraphQL API | Reading several related objects in one request and choosing the fields returned. |
| UI API and Connect REST API | Building user interfaces, with layout, field metadata, and formatting included. |
| Apex REST | Custom endpoints that run your own Apex logic. |
| Platform Events, Change Data Capture, Pub/Sub API | Publishing and subscribing to events, such as record changes. |
| Metadata API | Deploying and retrieving configuration such as objects, fields, and flows. |
| Tooling API | Building development tools, such as code editors and debuggers. |
Three questions that narrow the choice
You can often shortlist an API with three questions.
- What kind of data is involved? Business records point to the data APIs. Configuration or code points to Metadata or Tooling API.
- How much data, and how fast? Small, interactive requests suit REST. Millions of rows suit Bulk API 2.0.
- Who starts the exchange? If your client asks for data, use a request-response API. If Salesforce should tell you when something changes, use an event API.
The final chapter turns these questions into a full decision framework.
Common mistakes
- Using REST for a large migration. This consumes many calls and runs slowly, and Bulk API 2.0 is built for the job.
- Polling for changes every few seconds. Change Data Capture or Platform Events avoids the wasted calls.
- Treating Metadata API as a way to load records. It moves configuration only.
Exercise
A nightly job must load 3 million Contact records from a CSV file into Salesforce. Which group of APIs fits best, and why not a loop of single-record REST calls?
Show answer
Use the bulk group, specifically Bulk API 2.0. It processes large volumes asynchronously in one job. A loop of single-record REST calls would use millions of API calls and take far longer.
Exercise
Your team wants to deploy a new custom field from a sandbox to production using a script. Is this a data API task or a metadata and development task, and which API is the likely fit?
Show answer
It is a metadata and development task, because a field definition is configuration, not a business record. The Metadata API is the likely fit.