{ Community }
  • Academy
  • Docs
  • Developers
  • Resources
    • Community Articles
    • Apigee on GitHub
    • Code Samples
    • Videos & eBooks
    • Accelerator Methodology
  • Support
  • Ask a Question
  • Spaces
    • General
    • Edge/API Management
    • Developer Portal
    • API Design
    • APIM on Istio
    • Extensions
    • Business of APIs
    • Academy/Certification
    • Analytics
    • Events
    • Integration (AWS, PCF, Etc.)
    • Microgateway
    • Monetization
    • Private Cloud Deployment
    • Insights
    • IoT Apigee Link
    • BaaS/Usergrid
    • BaaS Transition/Migration
    • Apigee-127
    • New Customers
    • Topics
    • Questions
    • Articles
    • Ideas
    • Leaderboard
    • Badges
  • Log in
  • Sign up

Get answers, ideas, and support from the Apigee Community

  • Home /
  • Edge/API Management /
avatar image
6

How do I make Salesforce APIs more consumable with Apigee?  

  • Export to PDF
pbhogill created · Apr 29, 2015 at 05:24 PM · 2.4k Views · birute@google.com edited · May 07, 2015 at 05:23 AM

I run into Salesforce a lot these days, if you happen to be their customer, listen in. The next question then is how can Apigee help enable delightful & consumable APIs on top of Salesforce & API enable back-end systems to be accessible from Salesforce.

The question then is more importantly what are some of the benefits of doing that. Some of those benefits include providing end-to-end visibility into your Salesforce API usage, controlling and managing the several Salesforce Platform Limits and providing consistent security / transformation to support a variety of apps in your enterprise that need access to Salesforce data.

As you may be aware, Salesforce has a lot of different APIs, REST API, SOAP API, Chatter REST API, Bulk API etc.

There are fundamentally 2 different approaches to integrating with Salesforce from Apigee:

  • Using Service Callouts: This is where you will primarily use Service Callout policy to authenticate with Salesforce login/token endpoint, get an access token from them and start interacting with their REST API to do CRUD on standard (Account, Opportunity...etc) and custom objects. (The sample attached SalesforceAccount Proxy API bundle shows you how to do this approach. It assumes you have a Salesforce account (if not you can sign up here) and an Apigee account (if not, you can sign up here). You do need to create a KeyValue Map called "sfdc_creds" in the environment you deploy your proxy to for this to work. To do that you can use the management APIs:
Issue a POST request to <a href="https://api.enterprise.apigee.com/v1/organizations/{your-org-name}/environments/{your-env-name}/keyvaluemaps">https://api.enterprise.apigee.com/v1/organizations/{your-org-name}/environments/{your-env-name}/keyvaluemaps</a>

{   
 "name" : "sfdc_creds",
 "entry" : [ 
  {
   "name" : "username",
   "value" : "---your salesforce user name---"
  },
  {
   "name" : "password",
   "value" : "---your salesforce password + security token (without any spaces)---"
  } ,
  {
   "name" : "client_id",
   "value" : "---your client id from the connected app you create in sfdc---"
  } ,
  {
   "name" : "client-secret",
   "value" : "---your client secret from the connected app you create in sfdc--"
  } 
 ]
}

You need to create a connected app in Salesforce.

  • Using Volos Salesforce Connector: The Volos Salesforce connector is a Node.js module that lets you fetch data from Salesforce using a RESTful API. It is one of the Volos Node.js modules from Apigee.

The module maps Salesforce SOQL queries to RESTful API resources and query parameters. For example, a properly configured Salesforce connector might map a SOQL query like this:

SELECT id, Owner.Name FROM Opportunity WHERE Owner.Email='jdoe@example.com'

to a RESTful API that you could call like this:

curl <a href="http://localhost:9009/opportunity?ownerEmail=jdoe@example.com">http://localhost:9009/opportunity?ownerEmail=jdoe@example.com</a>

and which might generate a JSON response like this:

{
    "action": "GET",
    "params": {
        "qp": {}
    },
    "path": "/opportunity",
    "url": "/opportunity",
    "data": [
   {
        "attributes": {
            "type": "Opportunity",
            "url": "/services/data/v2.0/sobjects/Opportunity/05555555XcYHJ3"
        },
        "Id": "00670000XcYHJ3",
        "Owner": {
            "attributes": {
                "type": "User",
                "url": "/services/data/v2.0/sobjects/User/0057555555J12"
            },
            "Name": "John Doe"
        }
    },
 ...
],
    "targetMetadata": {},
    "timestamp": 1406156417290,
    "duration": 2888,
    "applicationName": "volos-salesforce",
    "count": 100,
    "sql": "SELECT id, Owner.Name FROM Opportunity LIMIT 100"
}

The SOQL-to-REST mapping is enabled by simple JSON configuration. Here is a sample:

    'opportunity': {
        queryStringBasic: 'SELECT id, Owner.Name FROM Opportunity',
        queryStringExpanded: 'SELECT id, AccountId, Account.Name, RecordType.Name, Owner.Name, Owner.Email FROM Opportunity',
        idName: 'id',
        queryParameters: {
            lastDays: 'lastmodifieddate=LAST_N_DAYS: {lastDays}',
            accountName: 'Account.Name = \'{accountName}\'',
            ownerName: 'Owner.Name = \'{ownerName}\'',
            ownerEmail: 'Owner.Email = \'{ownerEmail}\''
        }
    }

This is modeled in the SalesforceQuery Proxy API bundle.

I have attached the 2 API bundles.

salesforceaccount-rev1-2015-04-29.zipsalesforceaccount-rev1-2015-04-29.zip

Check out this end-to-end video recording of the demo if interested.

salesforceaccount-rev1-2015-04-29.zip (6.7 kB)
salesforceaccount-rev1-2015-04-29.zip (6.7 kB)
thub.nodes.view.add-new-comment
node.jssecurityvolossalesforceSFDC
Add comment Show 4
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image pbhogill ♦ · May 06, 2015 at 11:34 PM 0
Link

Here is the link to the end-to-end video recording of the demo if interested.

avatar image Surbhi · Jan 19, 2016 at 08:26 AM 0
Link

Hi,

Both bundles are of SalesforceAccount only. Could you please share bundle of SalesforceQuery.

Thanks,

avatar image Shrawan Raina · Mar 29, 2017 at 10:42 PM 0
Link

@Prithpal Bhogill Can you please also add the SalesforceQuery bundle. It seems both the links are for the SalesforceAccount bundle. Thanks!

avatar image Venu M · Oct 12, 2017 at 03:47 PM 0
Link
@pbhogill

There is a wide interest on the SalesforceQuery, can you add or point to the SalesforceQuery bundle.

Much Appreciated!

Article

Contributors

avatar image avatar image
Unfollow

Follow this article

12 People are following this .

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Navigation

How do I make Salesforce APIs more consumable with Apigee?

Related Articles

Known Issue: Two-way SSL to target server handshake failure due to property defined in HTTPTargetConnection

Using Apigee Edge with OpenID Connect

Contacting Support for CNAME or virtual host changes and whitelist IPs

Integrating the Curity OAuth server with Apigee Edge

Apigee as a SAML Identity Provider

How to import a NodeJS module to apigee edge?

Storing credentials,sensitive config - KVM v/s Vault

Node.js Performance Tips: Socket Pooling

3 new capabilities available in Apigee Edge (September)

Sample: Using Node.js caching with Edge policies

  • Products
    • Edge - APIs
    • Insights - Big Data
    • Plans
  • Developers
    • Overview
    • Documentation
  • Resources
    • Overview
    • Blog
    • Apigee Institute
    • Academy
    • Documentation
  • Company
    • Overview
    • Press
    • Customers
    • Partners
    • Team
    • Events
    • Careers
    • Contact Us
  • Support
    • Support Overview
    • Documentation
    • Status
    • Edge Support Portal
    • Privacy Policy
    • Terms & Conditions
© 2019 Apigee Corp. All rights reserved. - Apigee Community Terms of Use - Powered by AnswerHub
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Create an article
  • Post an idea
  • Spaces
  • General
  • Edge/API Management
  • Developer Portal
  • API Design
  • APIM on Istio
  • Extensions
  • Business of APIs
  • Academy/Certification
  • Analytics
  • Events
  • Integration (AWS, PCF, Etc.)
  • Microgateway
  • Monetization
  • Private Cloud Deployment
  • Insights
  • IoT Apigee Link
  • BaaS/Usergrid
  • BaaS Transition/Migration
  • Apigee-127
  • New Customers
  • Explore
  • Topics
  • Questions
  • Articles
  • Ideas
  • Members
  • Badges