Step by step setup guide to integrate Apigee with Salesforce
Integrating Apigee with salesforce requires an API Edge platform where you are able to create the proxy to connect the consumer applications and the cloud database servers for accessing the services. This blog gives you an overview about the Salesforce integration with Apigee which includes the concepts of API Edge platform, Architecture, Policies, Connectors, Salesforce APIs.
API Edge platform
Apigee is an API management platform that is designed to be scalable which helps to secure the APIs at an internet-scale. At a high-level API management platform is distributed into three different layers as API service, Analytics Services, and Developer Services also known as API Edge platform or API gateway.
It provides services that include end-to-end visibility across the entire API program. This layer comprises dashboards and reports for ops to determine the usage of an application, building the custom reports for developer metrics.
It demonstrates the developer ecosystem. It focuses more on the API consumption aspects. The developer portal contains the API documentation which uses the smart talks where developers can come and interact with APIs to get a good look and feel interfaces, this also comes up with the built apps. The monetization helps in monetizing the APIs such as RAID plans including the integration systems.
Architecture of Edge Platform
The Edge is a proxy layer that is set in the middle of API consumer Apps and the API resources such as backend services. The consumers’ API comprises applications such as mobile, point of sale, web, etc. The customers having the organic app servers communicate with the web services hosted on the cloud. The ESP or a middleware layer services enables the legacy systems which you may have as the Web services API. The cloud providers such as Salesforce are used for increasing the capacity.
Power of Policies
Apigee API management is a policy-oriented platform where you can use many policies of security, traffic management, mediation, and extension for configuration of the API proxy. These configuration policies help in managing the interactions with API consumers and optimize performance, Secure API, and protect back-end systems from attack, transform, translate and reformat data for easy consumption, extend with programming when you need. For instance, spike arrest policy configures Apigee Edge to block the access of any back-end systems beyond its specific TPS threshold.
NodeJS is a big area of investment for Apigee. There are various connectors for SaaS, SQL Database, Security API, Cloud storage, Asynchronous messaging and email connectors, etc. Volos connectors are built by Apigee that is widely used for open source projects.
The salesforce APIs provide programmatic access to your organization’s information using simple, powerful, and secure application programming interfaces.
Salesforce provides the following list of APIs.
REST API – Access objects in your organization using REST.
SOAP API – Integrate your organization’s data with other applications using SOAP.
Tooling API – Build custom development tools for Force.com applications.
Chatter REST API – Access Chatter feeds and social data such as users, groups, followers, and files using REST.
Bulk API – Load or delete large numbers of records.
Metadata API – Manage customizations in your org and build tools that manage the metadata model.
Streaming API – Provide a stream of data reflecting data changes in your organization.
Apex REST API – Build your own REST API in Apex. This API exposes Apex classes as RESTful Web services.
Apex SOAP API – Create custom SOAP web services in APex. This API exposes Apex classes as SOAP Web services.
Data.com API – Data.com provides 100% complete, high-quality data, updated in real-time in the cloud, and with comprehensive coverage worldwide.
Overview of Salesforce Integration
There are two different flavors of integration with salesforce known as Salesforce Account and Salesforce Query. The Salesforce account consists of the components that comprise SFDC REST API, Connected Apps, Service Callout policy, Key-value map, and Salesforce Query consist of the components that comprise SOQL, Volos connector, and Apigee vault. The SFDC REST API and Connected Apps are the capabilities of Salesforce while the components Service Callout policy and key-value map are used by Apigee. Likewise, the SOQL(Salesforce Object Query Language) of Salesforce Query is the capability of Salesforce while the other two components Volos connector and Apigee vault are used by Apigee.
SFDC accounting is going to leverage the REST API of Salesforce. Initially, we are going to see how we can use the service callouts to create different kinds of objects in salesforce. Salesforce Query leverages the Volos connector Apigee vault framework to use SOQL based queries. This provides the ability to query the different kinds of objects data that it contained. To get an idea on how to work on Salesforce, proper training is required to explore the concepts in depth where you could get this with the Salesforce Course available online.
Let’s begin with the Salesforce interface. Navigate to the developer portal and then signup for the salesforce platform and create a free developer account as shown in the below screen.
After registering, you can log in to the portal. Once you log in, you can see the following interface as shown on the below screen.
Let us now create a connection for Apigee proxy through the portal login. Click on the “New” option under “Create” menu in the left panel of “Build” category as shown in the below screen.
The following screen appears where you have to provide the details such as Connected App Name, API Name, email, enable OAuth Settings, etc. and then click on “Save”.
Once the connection is created you can now view the connected apps by clicking the “Apps” option under “create” menu on the left panel and then click on the connection “Apigee Proxy” under Connected Apps that was previously created.
Once you click on the “Apigee Proxy”, you can then view its details as shown in the below screen. Enabling the OAuth settings displays Consumer key and Consumer Secret which you will use to make the call outs to salesforce from API.
Let us now open the Apigee Edge Management User Interface where you are able to create various proxies within an organization and different environments where you can deploy proxies. The user interface of API Management appears as shown below.
Let us now explore for the Salesforce account proxy which was already built and type “Salesforce Account” in the search box as shown in the below screen.
You can now see what the Salesforce account proxy contains. This includes the target URL that points to the account object in the backend with its instance name of the Salesforce in the URL as shown in the below screen.
You can view all the policies that are configured in the “Develop” tab of a Salesforce account object creation. Within the account object you are able to view SFDC API and upon clicking the API the key value map is populated as shown in the below screen. You will load these credentials of key value maps then you will make a service call out to the token endpoint of salesforce and then will get the access token for future use.
Now let us search for Salesforce Query in the API Proxies which was already built.
Click on the Salesforce Query which displays a node script “VolosSalesforce.js” as its target endpoint which is running and processing requests as shown in below screen.
To view policies of Salesforce Query account object click on the “Develop” tab and to see the script file, click on the “VolosScript.js” on the left panel under “Node.js” as shown in the below screen.
The script describes a volos salesforce package which it requires for processing requests, access the vaults where you have to store the credentials and then the connector loads the profile with a restmap for queries. This will send the request to salesforce to get the data as its response.
You can view the queries which retrieves the specific records by opening the script “queryToRestMap.js” on the left panel. You can also add more queries in this program section depending on your needs.
Through the integration of Salesforce with Apigee, the platform offers the end to end visibility of real time usage with operational intelligence concerning the performance improvements. Using Apigee Edge you could use the traffic management policies to effectively control your platform Apex limits, static apex limits such as default timeouts of callouts, maximum size of callout request or response payloads, limiting the concurrent connections with concurrent policies. It ensures consistent and flexible security with API products, security and compliance tracking.