Introduction of Apex API

Salesforce API data classification

Salesforce provides four data API interface. API data interface provides the ability to manipulate Salesforce data for developers. they are, respectively:

  • REST API: New data based on RESTful methods, read, update, delete (CRUD) process. REST API supports JSON and XML format. REST API is lightweight API, or application processing network suitable for mobile applications.
  • SOAP API: SOAP-based protocol, using WSDL file format to process data. Only supports XML format. Adapted to communicate between servers.
  • Bulk API: is a special custom REST API, for processing large quantities of data (50 000 records or more) have better results.
  • Streaming API: sending a prompt message applies when data changes.

Enable API access

To use the API, it requires the user's profile, the (API Enabled) "API-enabled" check box is checked.

API restrictions

There are two Salesforce API restrictions. "Concurrency limit" limit the number of simultaneously operating duration is greater than 20 seconds API requests, "quantity" limits the total number of API operation request within 24 hours.

To see the remaining number of API can run, you can search for "System Overview" in the settings interface, open "System Overview" page. In the 'API Usage "section you can see the number of API runs in the last 24 hours, and the maximum number allowed.

System Overview Interface

To set use the notification API, you can search for "API use notice" open "to use all API Notification" interface settings interface. Click the "New" button to create a new notification API use, when the number of API usage reaches a certain threshold, it will automatically send mail notification related to the user.

Editing API interface to use notice

Generate API WSDL file

In the setup interface, search for "API", click on the "Development" menu item under the "API" link, enter "API WSDL" page.

API WSDL interface

On this page, you can generate and download a variety of WSDL and client certificates for API developers.

such as:

  • Click on the "Generate Enterprise WSDL" link, click on the "Generate" button in the window that appears, you can get a WSDL file
  • API to communicate with this new project file in SoapUI in, you can create the corresponding Salesforce system
  • Developers can use the "login" operations to a login request. Note that when you log in Salesforce, part of the password you need to enter a password and password security (Security Token). For example, the password is "123", the security password is "abc", then " "Tab to enter" 123abc "examples are as follows:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:enterprise.soap.sforce.com">
   <soapenv:Header>
      <urn:LoginScopeHeader>
         <urn:organizationId></urn:organizationId>
         <!--Optional:-->
         <urn:portalId></urn:portalId>
      </urn:LoginScopeHeader>
   </soapenv:Header>
   <soapenv:Body>
      <urn:login>
         <urn:username>用户名</urn:username>
         <urn:password>密码和安全口令</urn:password>
      </urn:login>
   </soapenv:Body>
</soapenv:Envelope>
  • After a successful login, the system generates a session ID (in " "Tab) and server URL (in the" "Tab). Developers need to record them, the other for use in subsequent requests of
  • Developers can use, such as "create" operation request to other operations of the various objects. Enter the appropriate values ​​in the respective Tags and the previous input in the corresponding session ID Tags or server URL, send a request to complete the process

The difference between the enterprise WSDL and WSDL Partner of

Salesforce is the most frequently used are two WSDL:

  • 企业WSDL(Enterprise WSDL)
  • Partner WSDL (Partner WSDL)

They have the following characteristics:

  1. Enterprise WSDL is strongly typed, and it's a specific Salesforce organization closely linked. When this organization was modified Salesforce, such as custom fields, objects are modified, the resulting company will be different WSDL
  2. Partner WSDL is loosely typed, and no specific Salesforce organization together, so when Salesforce organization is modified, does not generate different partners WSDL

If developers need for a particular Salesforce organization CRUD operations through the API, you use the enterprise WSDL. If the handling of multiple Salesforce organization, use the partner WSDL.

Guess you like

Origin www.cnblogs.com/chengcheng0148/p/apex_api_basic.html