SlideShare a Scribd company logo
1 of 16
Integrating Force.com with Heroku
Force.com Developer Meetup – Washington, DC August 8 2012




Pat Patterson
Principal Developer Evangelist
@metadaddy




                        Follow us @forcedotcom
Safe Harbor
Safe harbor statement under the Private Securities Litigation Reform Act of 1995: This presentation may
contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such
uncertainties materialize or if any of the assumptions proves incorrect, the results of salesforce.com, inc.
could differ materially from the results expressed or implied by the forward-looking statements we make. All
statements other than statements of historical fact could be deemed forward-looking, including any
projections of subscriber growth, earnings, revenues, or other financial items and any statements regarding
strategies or plans of management for future operations, statements of belief, any statements concerning
new, planned, or upgraded services or technology developments and customer contracts or use of our
services.

The risks and uncertainties referred to above include – but are not limited to – risks associated with
developing and delivering new functionality for our service, our new business model, our past operating
losses, possible fluctuations in our operating results and rate of growth, interruptions or delays in our Web
hosting, breach of our security measures, risks associated with possible mergers and acquisitions, the
immature market in which we operate, our relatively limited operating history, our ability to expand, retain,
and motivate our employees and manage our growth, new releases of our service and successful customer
deployment, our limited history reselling non-salesforce.com products, and utilization and selling to larger
enterprise customers. Further information on potential factors that could affect the financial results of
salesforce.com, inc. is included in our annual report on Form 10-K for the most recent fiscal year ended
January 31, 2012. This document and others are available on the SEC Filings section of the Investor
Information section of our Web site.

Any unreleased services or features referenced in this or other press releases or public statements are not
currently available and may not be delivered on time or at all. Customers who purchase our services should
make the purchase decisions based upon features that are currently available. Salesforce.com, inc.
assumes no obligation and does not intend to update these forward-looking statements.
Agenda
                                        NEW!!!



 Force.com app ->Web Service

 External app ->Force.com


                                                 NEW!!!


 HerokuPostgres Data Clips




               Follow us @forcedotcom
Calling Web Services from Force.com




                    REST/SOAP Request




                   REST/SOAP Response

   Force.com app                            External System




                   Follow us @forcedotcom
Interactive Context

  For example, user presses custom button
    – Call web service synchronously from controller
      // Create jsonString, then...

      HttpRequestreq = new HttpRequest();

      req.setMethod('POST');
      req.setEndpoint('https://webservice.herokuapp.com/order');
      req.setHeader('Content-Type', 'application/json');
      req.setBody(jsonString);

      Http http = new Http();
      res = http.send(req);

      // Now parse response and update record(s)


                          Follow us @forcedotcom
Trigger Context

  Synchronous callouts are not allowed!
    – Call web service asynchronously from trigger
      // In Apex Trigger, build list of ids, then...

      Integration.postOrder(invoiceIds);

      // Define asynchronous method in Apex Class
      @future (callout=true)
      public static void postOrder(List<Id>invoiceIds) {
          // ...
      }




                          Follow us @forcedotcom
Calling Force.com from External Apps




                    REST/SOAP Request




                   REST/SOAP Response

   Force.com app                            External System




                   Follow us @forcedotcom
Force.com REST API

  Record-oriented REST API
    – Invoke HTTP POST/GET/PATCH/DELETE on URLs
    – https://na9.salesforce.com/services/data/v25.0/
      sobjects/Invoice_Statement__c/a01E0000000BsAz
  Query and Search Endpoints
    – .../v25.0/query?q=SELECT+Invoice_Value__c+FROM+
      Invoice_Statement__c
  Authenticate via OAuth
    – Interactive or username/password




                         Follow us @forcedotcom
Accessible From Any Environment

 $ curl -H 'X-PrettyPrint: 1’ -H 'Authorization: Bearer XXX'
    https://na1.salesforce.com/services/data/v25.0/sobjects/Invoic
    e_Statement__c/a015000000W5a5YAAR
 {
     "attributes" : {
          "type" : "Invoice_Statement__c",
      "url" :
     "/services/data/v25.0/sobjects/Invoice_Statement__c/a015000000
     W5a5YAAR"
     },
     "Id" : "a015000000W5a5YAAR",
     "OwnerId" : "00550000001fg5OAAQ",
 …



                              Follow us @forcedotcom
Force.com REST API Connector

  Lightweight Java library
    – https://github.com/jesperfj/force-rest-api
  Includes OAuth implementations
  Define model classes for standard/custom object
  Easy CRUD
    // Set up api object from config, session, then...
    Account a = new Account();
    a.setName("Test account");
    String id = api.createSObject("account", a);


    a= api.getSObject("Account",id).as(Account.class);

                            Follow us @forcedotcom
Apex REST Methods

  Insert/update many records in a single transaction
    @RestResource(urlMapping='/Invoice/*')
    global class QuickInvoiceService {


      @HttpPost
      global static String
      createInvoiceAndItem(String description,
      StringmerchId, Integer units) {
          // Create invoice and line item records
          // Either both are created or neither
      }


                       Follow us @forcedotcom
HerokuPostgres Data Clips                           NEW!!!


  HTML, JSON, CSV, YAML representations of a SQL
   Query
   SELECT
     "characters"."name" AS "character_name",
   SUM(length("paragraphs"."plain_text")) as "letter_count",
     COUNT(*) as "paragraph_count",
   SUM(length("paragraphs"."plain_text"))/COUNT(*) as
     "drone_factor"
   FROM "paragraphs”
   INNER JOIN "characters" ON "paragraphs"."character_id" =
     "characters"."id”


   https://postgres.heroku.com/dataclips/ljfeywbwtxbcabardaxvcstjyodi



                           Follow us @forcedotcom
Integrating Data Clips with Force.com

  Just another REST call to retrieve JSON data…
  Define Apex Class to model data
    public class DroneFactor {


        public String character_name;
        public String letter_count;
        public String paragraph_count;
        public String drone_factor;


        public static DroneFactorparse(Stringjson) {
          return (DroneFactor) System.JSON.deserialize(json,
        DroneFactor.class);
    }
    }


                             Follow us @forcedotcom
Integrating Data Clips with Force.com

  Write client to retrieve JSON
    public class DroneFactorClient {
    public static List<DroneFactor> get() {
    HttpRequestreq = new HttpRequest();
    req.setEndpoint('https://postgres.heroku.com/dataclips/ljfeywbwtxbcabar
       daxvcstjyodi.json');
    req.setMethod('GET');


    Http http = new Http();
    HTTPResponse res = http.send(req);
    System.debug('Data Clip response code: '+res.getStatusCode()+'. Status:
       '+res.getStatus());
    return (List<DroneFactor>)System.JSON.deserialize(res.getBody(),
       List<DroneFactor>.class);
    }
    }
                              Follow us @forcedotcom
Resources

 Force.com Integration Workbook
  http://wiki.developerforce.com/page/Force.com_workbook#Force.com_Integration_
  Workbook


 Force.comREST API Connector
  https://github.com/jesperfj/force-rest-api


 Integrating Force.com and HerokuPostgres with Data
  Clips
  http://blogs.developerforce.com/developer-relations/2012/08/integrating-
  force-com-and-heroku-postgres-with-data-clips.html




                                 Follow us @forcedotcom
Q&A

@metadaddy
Follow us @forcedotcom

More Related Content

What's hot

Developing Offline-Capable Apps with the Salesforce Mobile SDK and SmartStore
Developing Offline-Capable Apps with the Salesforce Mobile SDK and SmartStoreDeveloping Offline-Capable Apps with the Salesforce Mobile SDK and SmartStore
Developing Offline-Capable Apps with the Salesforce Mobile SDK and SmartStore
Salesforce Developers
 

What's hot (20)

Dreamforce 2013 - Heroku 5 use cases
Dreamforce 2013 - Heroku 5 use casesDreamforce 2013 - Heroku 5 use cases
Dreamforce 2013 - Heroku 5 use cases
 
Two-Way Integration with Writable External Objects
Two-Way Integration with Writable External ObjectsTwo-Way Integration with Writable External Objects
Two-Way Integration with Writable External Objects
 
Let's Learn About Heroku and How to Integrate with Salesforce
Let's Learn About Heroku and How to Integrate with SalesforceLet's Learn About Heroku and How to Integrate with Salesforce
Let's Learn About Heroku and How to Integrate with Salesforce
 
Developing Offline Mobile Apps with Salesforce Mobile SDK SmartStore
Developing Offline Mobile Apps with Salesforce Mobile SDK SmartStoreDeveloping Offline Mobile Apps with Salesforce Mobile SDK SmartStore
Developing Offline Mobile Apps with Salesforce Mobile SDK SmartStore
 
Unite Customer-Facing Apps with a Salesforce Backend: Heroku Connect in Practice
Unite Customer-Facing Apps with a Salesforce Backend: Heroku Connect in PracticeUnite Customer-Facing Apps with a Salesforce Backend: Heroku Connect in Practice
Unite Customer-Facing Apps with a Salesforce Backend: Heroku Connect in Practice
 
Reinvent your App Dev Lifecycle with Continuous Delivery on Heroku
Reinvent your App Dev Lifecycle with Continuous Delivery on HerokuReinvent your App Dev Lifecycle with Continuous Delivery on Heroku
Reinvent your App Dev Lifecycle with Continuous Delivery on Heroku
 
Building BOTS on App Cloud
Building BOTS on App CloudBuilding BOTS on App Cloud
Building BOTS on App Cloud
 
Lightning Connect Custom Adapters: Connecting Anything with Salesforce
Lightning Connect Custom Adapters: Connecting Anything with SalesforceLightning Connect Custom Adapters: Connecting Anything with Salesforce
Lightning Connect Custom Adapters: Connecting Anything with Salesforce
 
Developing Offline Mobile Apps with the Salesforce.com Mobile SDK SmartStore,...
Developing Offline Mobile Apps with the Salesforce.com Mobile SDK SmartStore,...Developing Offline Mobile Apps with the Salesforce.com Mobile SDK SmartStore,...
Developing Offline Mobile Apps with the Salesforce.com Mobile SDK SmartStore,...
 
Coding Apps in the Cloud with Force.com - Part 2
Coding Apps in the Cloud with Force.com - Part 2Coding Apps in the Cloud with Force.com - Part 2
Coding Apps in the Cloud with Force.com - Part 2
 
Build your API with Force.com and Heroku
Build your API with Force.com and HerokuBuild your API with Force.com and Heroku
Build your API with Force.com and Heroku
 
Salesforce integration with heroku apps made easy
Salesforce integration with heroku apps made easySalesforce integration with heroku apps made easy
Salesforce integration with heroku apps made easy
 
Use Custom Metadata Types for Easy ALM & Compliance for Your Custom Apps
Use Custom Metadata Types for Easy ALM & Compliance for Your Custom AppsUse Custom Metadata Types for Easy ALM & Compliance for Your Custom Apps
Use Custom Metadata Types for Easy ALM & Compliance for Your Custom Apps
 
Forcelandia 2015
Forcelandia 2015Forcelandia 2015
Forcelandia 2015
 
Integrating with salesforce
Integrating with salesforceIntegrating with salesforce
Integrating with salesforce
 
Unlock the Value of your Salesforce Data at Scale with Heroku Connect
Unlock the Value of your Salesforce Data at Scale with Heroku ConnectUnlock the Value of your Salesforce Data at Scale with Heroku Connect
Unlock the Value of your Salesforce Data at Scale with Heroku Connect
 
Introduction to HEROKU Salesforce1 Platform DevDay
Introduction to HEROKU Salesforce1 Platform DevDayIntroduction to HEROKU Salesforce1 Platform DevDay
Introduction to HEROKU Salesforce1 Platform DevDay
 
Developing Offline-Capable Apps with the Salesforce Mobile SDK and SmartStore
Developing Offline-Capable Apps with the Salesforce Mobile SDK and SmartStoreDeveloping Offline-Capable Apps with the Salesforce Mobile SDK and SmartStore
Developing Offline-Capable Apps with the Salesforce Mobile SDK and SmartStore
 
Salesforce API Series: Integrating Applications with Force.com Webinar
Salesforce API Series: Integrating Applications with Force.com WebinarSalesforce API Series: Integrating Applications with Force.com Webinar
Salesforce API Series: Integrating Applications with Force.com Webinar
 
Salesforce Integration
Salesforce IntegrationSalesforce Integration
Salesforce Integration
 

Viewers also liked (6)

Heroku Connect: The New Way to Build Connected Customer Applications
Heroku Connect: The New Way to Build Connected Customer ApplicationsHeroku Connect: The New Way to Build Connected Customer Applications
Heroku Connect: The New Way to Build Connected Customer Applications
 
원격지 개발사업 관리가이드 발표20121020
원격지 개발사업 관리가이드 발표20121020원격지 개발사업 관리가이드 발표20121020
원격지 개발사업 관리가이드 발표20121020
 
Heroku - developer playground
Heroku - developer playground Heroku - developer playground
Heroku - developer playground
 
Heroku 101 py con 2015 - David Gouldin
Heroku 101   py con 2015 - David GouldinHeroku 101   py con 2015 - David Gouldin
Heroku 101 py con 2015 - David Gouldin
 
Webservices in SalesForce (part 1)
Webservices in SalesForce (part 1)Webservices in SalesForce (part 1)
Webservices in SalesForce (part 1)
 
Dreamforce 2016 Investor Day
Dreamforce 2016 Investor DayDreamforce 2016 Investor Day
Dreamforce 2016 Investor Day
 

Similar to Integrating Force.com with Heroku

CiklumJavaSat_15112011:Alex Kruk VMForce
CiklumJavaSat_15112011:Alex Kruk VMForceCiklumJavaSat_15112011:Alex Kruk VMForce
CiklumJavaSat_15112011:Alex Kruk VMForce
Ciklum Ukraine
 
ELEVATE Advanced Workshop
ELEVATE Advanced WorkshopELEVATE Advanced Workshop
ELEVATE Advanced Workshop
Joshua Birk
 
S-Controls for Dummies
S-Controls for DummiesS-Controls for Dummies
S-Controls for Dummies
dreamforce2006
 
S-Controls for Dummies
S-Controls for DummiesS-Controls for Dummies
S-Controls for Dummies
dreamforce2006
 
Claims Based Identity In Share Point 2010
Claims  Based  Identity In  Share Point 2010Claims  Based  Identity In  Share Point 2010
Claims Based Identity In Share Point 2010
Steve Sofian
 
Intro to AppExchange - Building Composite Apps
Intro to AppExchange - Building Composite AppsIntro to AppExchange - Building Composite Apps
Intro to AppExchange - Building Composite Apps
dreamforce2006
 

Similar to Integrating Force.com with Heroku (20)

ELEVATE Paris
ELEVATE ParisELEVATE Paris
ELEVATE Paris
 
Introduction to Developing Android Apps With the Salesforce Mobile SDK
Introduction to Developing Android Apps With the Salesforce Mobile SDKIntroduction to Developing Android Apps With the Salesforce Mobile SDK
Introduction to Developing Android Apps With the Salesforce Mobile SDK
 
Detroit ELEVATE Track 2
Detroit ELEVATE Track 2Detroit ELEVATE Track 2
Detroit ELEVATE Track 2
 
CiklumJavaSat_15112011:Alex Kruk VMForce
CiklumJavaSat_15112011:Alex Kruk VMForceCiklumJavaSat_15112011:Alex Kruk VMForce
CiklumJavaSat_15112011:Alex Kruk VMForce
 
ELEVATE Advanced Workshop
ELEVATE Advanced WorkshopELEVATE Advanced Workshop
ELEVATE Advanced Workshop
 
Dive Deep into Apex: Advanced Apex!
Dive Deep into Apex: Advanced Apex! Dive Deep into Apex: Advanced Apex!
Dive Deep into Apex: Advanced Apex!
 
Advanced Apex Webinar
Advanced Apex WebinarAdvanced Apex Webinar
Advanced Apex Webinar
 
S-Controls for Dummies
S-Controls for DummiesS-Controls for Dummies
S-Controls for Dummies
 
S-Controls for Dummies
S-Controls for DummiesS-Controls for Dummies
S-Controls for Dummies
 
Claims Based Identity In Share Point 2010
Claims  Based  Identity In  Share Point 2010Claims  Based  Identity In  Share Point 2010
Claims Based Identity In Share Point 2010
 
February 2020 Salesforce API Review
February 2020 Salesforce API ReviewFebruary 2020 Salesforce API Review
February 2020 Salesforce API Review
 
Intro to AppExchange - Building Composite Apps
Intro to AppExchange - Building Composite AppsIntro to AppExchange - Building Composite Apps
Intro to AppExchange - Building Composite Apps
 
Lightning Component - Components, Actions and Events
Lightning Component - Components, Actions and EventsLightning Component - Components, Actions and Events
Lightning Component - Components, Actions and Events
 
Java Script Isn\'t a Toy Anymore
Java Script Isn\'t a Toy AnymoreJava Script Isn\'t a Toy Anymore
Java Script Isn\'t a Toy Anymore
 
MongoDB Stitch Tutorial
MongoDB Stitch TutorialMongoDB Stitch Tutorial
MongoDB Stitch Tutorial
 
ここまでできる!Salesforce Connect 最新機能 (Winter'17) のご紹介
ここまでできる!Salesforce Connect 最新機能 (Winter'17) のご紹介ここまでできる!Salesforce Connect 最新機能 (Winter'17) のご紹介
ここまでできる!Salesforce Connect 最新機能 (Winter'17) のご紹介
 
Salesforce1 Platform for programmers
Salesforce1 Platform for programmersSalesforce1 Platform for programmers
Salesforce1 Platform for programmers
 
The Definitive Guide to PromptCloud API
The Definitive Guide to PromptCloud APIThe Definitive Guide to PromptCloud API
The Definitive Guide to PromptCloud API
 
Introduction to the Wave Platform API
Introduction to the Wave Platform APIIntroduction to the Wave Platform API
Introduction to the Wave Platform API
 
Javascript and Remote Objects on Force.com Winter 15
Javascript and Remote Objects on Force.com Winter 15Javascript and Remote Objects on Force.com Winter 15
Javascript and Remote Objects on Force.com Winter 15
 

More from Pat Patterson

More from Pat Patterson (20)

DevOps from the Provider Perspective
DevOps from the Provider PerspectiveDevOps from the Provider Perspective
DevOps from the Provider Perspective
 
How Imprivata Combines External Data Sources for Business Insights
How Imprivata Combines External Data Sources for Business InsightsHow Imprivata Combines External Data Sources for Business Insights
How Imprivata Combines External Data Sources for Business Insights
 
Data Integration with Apache Kafka: What, Why, How
Data Integration with Apache Kafka: What, Why, HowData Integration with Apache Kafka: What, Why, How
Data Integration with Apache Kafka: What, Why, How
 
Project Ouroboros: Using StreamSets Data Collector to Help Manage the StreamS...
Project Ouroboros: Using StreamSets Data Collector to Help Manage the StreamS...Project Ouroboros: Using StreamSets Data Collector to Help Manage the StreamS...
Project Ouroboros: Using StreamSets Data Collector to Help Manage the StreamS...
 
Dealing with Drift: Building an Enterprise Data Lake
Dealing with Drift: Building an Enterprise Data LakeDealing with Drift: Building an Enterprise Data Lake
Dealing with Drift: Building an Enterprise Data Lake
 
Integrating with Einstein Analytics
Integrating with Einstein AnalyticsIntegrating with Einstein Analytics
Integrating with Einstein Analytics
 
Efficient Schemas in Motion with Kafka and Schema Registry
Efficient Schemas in Motion with Kafka and Schema RegistryEfficient Schemas in Motion with Kafka and Schema Registry
Efficient Schemas in Motion with Kafka and Schema Registry
 
Dealing With Drift - Building an Enterprise Data Lake
Dealing With Drift - Building an Enterprise Data LakeDealing With Drift - Building an Enterprise Data Lake
Dealing With Drift - Building an Enterprise Data Lake
 
Building Data Pipelines with Spark and StreamSets
Building Data Pipelines with Spark and StreamSetsBuilding Data Pipelines with Spark and StreamSets
Building Data Pipelines with Spark and StreamSets
 
Adaptive Data Cleansing with StreamSets and Cassandra
Adaptive Data Cleansing with StreamSets and CassandraAdaptive Data Cleansing with StreamSets and Cassandra
Adaptive Data Cleansing with StreamSets and Cassandra
 
Building Custom Big Data Integrations
Building Custom Big Data IntegrationsBuilding Custom Big Data Integrations
Building Custom Big Data Integrations
 
Ingest and Stream Processing - What will you choose?
Ingest and Stream Processing - What will you choose?Ingest and Stream Processing - What will you choose?
Ingest and Stream Processing - What will you choose?
 
Open Source Big Data Ingestion - Without the Heartburn!
Open Source Big Data Ingestion - Without the Heartburn!Open Source Big Data Ingestion - Without the Heartburn!
Open Source Big Data Ingestion - Without the Heartburn!
 
Ingest and Stream Processing - What will you choose?
Ingest and Stream Processing - What will you choose?Ingest and Stream Processing - What will you choose?
Ingest and Stream Processing - What will you choose?
 
All Aboard the Boxcar! Going Beyond the Basics of REST
All Aboard the Boxcar! Going Beyond the Basics of RESTAll Aboard the Boxcar! Going Beyond the Basics of REST
All Aboard the Boxcar! Going Beyond the Basics of REST
 
Provisioning IDaaS - Using SCIM to Enable Cloud Identity
Provisioning IDaaS - Using SCIM to Enable Cloud IdentityProvisioning IDaaS - Using SCIM to Enable Cloud Identity
Provisioning IDaaS - Using SCIM to Enable Cloud Identity
 
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
OData: Universal Data Solvent or Clunky Enterprise Goo? (GlueCon 2015)
 
Enterprise IoT: Data in Context
Enterprise IoT: Data in ContextEnterprise IoT: Data in Context
Enterprise IoT: Data in Context
 
OData: A Standard API for Data Access
OData: A Standard API for Data AccessOData: A Standard API for Data Access
OData: A Standard API for Data Access
 
API-Driven Relationships: Building The Trans-Internet Express of the Future
API-Driven Relationships: Building The Trans-Internet Express of the FutureAPI-Driven Relationships: Building The Trans-Internet Express of the Future
API-Driven Relationships: Building The Trans-Internet Express of the Future
 

Recently uploaded

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Recently uploaded (20)

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 

Integrating Force.com with Heroku

  • 1. Integrating Force.com with Heroku Force.com Developer Meetup – Washington, DC August 8 2012 Pat Patterson Principal Developer Evangelist @metadaddy Follow us @forcedotcom
  • 2. Safe Harbor Safe harbor statement under the Private Securities Litigation Reform Act of 1995: This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties materialize or if any of the assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results expressed or implied by the forward-looking statements we make. All statements other than statements of historical fact could be deemed forward-looking, including any projections of subscriber growth, earnings, revenues, or other financial items and any statements regarding strategies or plans of management for future operations, statements of belief, any statements concerning new, planned, or upgraded services or technology developments and customer contracts or use of our services. The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new functionality for our service, our new business model, our past operating losses, possible fluctuations in our operating results and rate of growth, interruptions or delays in our Web hosting, breach of our security measures, risks associated with possible mergers and acquisitions, the immature market in which we operate, our relatively limited operating history, our ability to expand, retain, and motivate our employees and manage our growth, new releases of our service and successful customer deployment, our limited history reselling non-salesforce.com products, and utilization and selling to larger enterprise customers. Further information on potential factors that could affect the financial results of salesforce.com, inc. is included in our annual report on Form 10-K for the most recent fiscal year ended January 31, 2012. This document and others are available on the SEC Filings section of the Investor Information section of our Web site. Any unreleased services or features referenced in this or other press releases or public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make the purchase decisions based upon features that are currently available. Salesforce.com, inc. assumes no obligation and does not intend to update these forward-looking statements.
  • 3. Agenda NEW!!! Force.com app ->Web Service External app ->Force.com NEW!!! HerokuPostgres Data Clips Follow us @forcedotcom
  • 4. Calling Web Services from Force.com REST/SOAP Request REST/SOAP Response Force.com app External System Follow us @forcedotcom
  • 5. Interactive Context  For example, user presses custom button – Call web service synchronously from controller // Create jsonString, then... HttpRequestreq = new HttpRequest(); req.setMethod('POST'); req.setEndpoint('https://webservice.herokuapp.com/order'); req.setHeader('Content-Type', 'application/json'); req.setBody(jsonString); Http http = new Http(); res = http.send(req); // Now parse response and update record(s) Follow us @forcedotcom
  • 6. Trigger Context  Synchronous callouts are not allowed! – Call web service asynchronously from trigger // In Apex Trigger, build list of ids, then... Integration.postOrder(invoiceIds); // Define asynchronous method in Apex Class @future (callout=true) public static void postOrder(List<Id>invoiceIds) { // ... } Follow us @forcedotcom
  • 7. Calling Force.com from External Apps REST/SOAP Request REST/SOAP Response Force.com app External System Follow us @forcedotcom
  • 8. Force.com REST API  Record-oriented REST API – Invoke HTTP POST/GET/PATCH/DELETE on URLs – https://na9.salesforce.com/services/data/v25.0/ sobjects/Invoice_Statement__c/a01E0000000BsAz  Query and Search Endpoints – .../v25.0/query?q=SELECT+Invoice_Value__c+FROM+ Invoice_Statement__c  Authenticate via OAuth – Interactive or username/password Follow us @forcedotcom
  • 9. Accessible From Any Environment $ curl -H 'X-PrettyPrint: 1’ -H 'Authorization: Bearer XXX' https://na1.salesforce.com/services/data/v25.0/sobjects/Invoic e_Statement__c/a015000000W5a5YAAR { "attributes" : { "type" : "Invoice_Statement__c", "url" : "/services/data/v25.0/sobjects/Invoice_Statement__c/a015000000 W5a5YAAR" }, "Id" : "a015000000W5a5YAAR", "OwnerId" : "00550000001fg5OAAQ", … Follow us @forcedotcom
  • 10. Force.com REST API Connector  Lightweight Java library – https://github.com/jesperfj/force-rest-api  Includes OAuth implementations  Define model classes for standard/custom object  Easy CRUD // Set up api object from config, session, then... Account a = new Account(); a.setName("Test account"); String id = api.createSObject("account", a); a= api.getSObject("Account",id).as(Account.class); Follow us @forcedotcom
  • 11. Apex REST Methods  Insert/update many records in a single transaction @RestResource(urlMapping='/Invoice/*') global class QuickInvoiceService { @HttpPost global static String createInvoiceAndItem(String description, StringmerchId, Integer units) { // Create invoice and line item records // Either both are created or neither } Follow us @forcedotcom
  • 12. HerokuPostgres Data Clips NEW!!!  HTML, JSON, CSV, YAML representations of a SQL Query SELECT "characters"."name" AS "character_name", SUM(length("paragraphs"."plain_text")) as "letter_count", COUNT(*) as "paragraph_count", SUM(length("paragraphs"."plain_text"))/COUNT(*) as "drone_factor" FROM "paragraphs” INNER JOIN "characters" ON "paragraphs"."character_id" = "characters"."id” https://postgres.heroku.com/dataclips/ljfeywbwtxbcabardaxvcstjyodi Follow us @forcedotcom
  • 13. Integrating Data Clips with Force.com  Just another REST call to retrieve JSON data…  Define Apex Class to model data public class DroneFactor { public String character_name; public String letter_count; public String paragraph_count; public String drone_factor; public static DroneFactorparse(Stringjson) { return (DroneFactor) System.JSON.deserialize(json, DroneFactor.class); } } Follow us @forcedotcom
  • 14. Integrating Data Clips with Force.com  Write client to retrieve JSON public class DroneFactorClient { public static List<DroneFactor> get() { HttpRequestreq = new HttpRequest(); req.setEndpoint('https://postgres.heroku.com/dataclips/ljfeywbwtxbcabar daxvcstjyodi.json'); req.setMethod('GET'); Http http = new Http(); HTTPResponse res = http.send(req); System.debug('Data Clip response code: '+res.getStatusCode()+'. Status: '+res.getStatus()); return (List<DroneFactor>)System.JSON.deserialize(res.getBody(), List<DroneFactor>.class); } } Follow us @forcedotcom
  • 15. Resources  Force.com Integration Workbook http://wiki.developerforce.com/page/Force.com_workbook#Force.com_Integration_ Workbook  Force.comREST API Connector https://github.com/jesperfj/force-rest-api  Integrating Force.com and HerokuPostgres with Data Clips http://blogs.developerforce.com/developer-relations/2012/08/integrating- force-com-and-heroku-postgres-with-data-clips.html Follow us @forcedotcom