SFDC唸書筆記: Lightning Platform API Basics
# SFDC唸書筆記: Lightning Platform API Basics
https://trailhead.salesforce.com/content/learn/modules/api_basics
## 四大API類型概述 Get to Know the Salesforce Lightning Platform APIs
note: 以下四大API並非按MECE原則分類,例如Bulk API其實就是REST API的一種。
### REST API
輕便好用
### SOAP API
幾乎所有SOAP可以做到的事,REST也都可以做到。
兩者只是遵循著不同的協議標準而已。
SOAP使用WSDL,較常見的應用場景為server-to-server integration。或是integrate with your org’s ERP and finance systems
Salesforce provides two SOAP API WSDLs for two different use cases.
Typically, if you’re writing an integration for a single Salesforce org, use the enterprise WSDL. For several orgs, use the partner WSDL.
### Bulk API
異步處理(asynchronous),用於大量資料(record count > 50,000)的場景。
### Streaming API
當data變動時,觸發通知。APP就不需要不斷地輪循。
### API quota限制
兩種限制:
- 並發限制(Concurrent limits): 同時不能有超過n個long-running calls(20 seconds or longer)
- 總量限制:連續24小時內可使用的API總量
實際可用quota視貴公司財力而定。有錢都買得到XD
### 哪裡可以查還剩多少額度可以用? How to check remaining API calls?
You have several ways to check your remaining API calls.
- The API Usage box on the System Overview page. (From Setup, enter System Overview in the Quick Find box, then select System Overview.)
- Information returned in the Sforce-Limit-Info response header for REST APIs.
- Information returned in the response body (in <type>API REQUESTS</type>) for SOAP APIs.
- The /limits call in the Lightning Platform REST API.
- The API Request Limit per Month usage-based entitlement, which shows you your org’s API calls aggregated over 30 days.
### 其它API重點
#### User Interface API
- let users work with records, list views, actions, favorites, and more.
- get data and metadata in a single response
- don’t have to worry about layouts, picklists, field-level security, or sharing
#### Bulk API
- query, queryAll, insert, update, upsert, or delete many records asynchronously by submitting batches. Salesforce processes batches in the background.
- The easiest way to use Bulk API is to enable it for processing records in Data Loader using CSV files. Using Data Loader avoids the need to write your own client application.
- Bulk API uses the same framework that the REST API uses, which means that Bulk API supports many of the same features, such as OAuth authentication.
#### Metadata API
- The easiest way to access is to use the Salesforce Extensions for Visual Studio Code or the Ant Migration Tool.
- The Salesforce Extensions for Visual Studio Code includes tools for developing on the Salesforce platform in the lightweight, extensible VS Code editor. These tools provide features for working with development orgs (scratch orgs, sandboxes, and DE orgs), Apex, Aura components, and Visualforce.
- The Ant Migration Tool is ideal if you use a script or the command line for moving metadata between a local directory and a Salesforce org.
#### Streaming API
- Platform Event: Publish and receive custom payloads with a predefined schema.
- PushTopic Event: Receive changes to Salesforce records based on a SOQL query that you define. The notifications include only the fields that you specify in the SOQL query.
- Change Data Capture Event: Receive changes to Salesforce records with all changed fields.
- Generic Event: Publish and receive arbitrary payloads without a defined schema.
#### Apex REST API
把Apex Class包成REST API的時候可用
#### Apex SOAP API
把Apex Class包成SOAP API的時候可用
#### Tooling API
(暫時沒理解到)
留言
張貼留言