Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Build your API with Force.com &
Heroku
Jeff Douglas, Appirio, CloudSpokes Platform Architect
@jeffdonthemic
Safe harbor
Safe harbor statement under the Private Securities Litigation Reform Act of 1995:
This presentation may contai...
Jeff Douglas
CloudSpokes Platform Architect
@jeffdonthemic
All about CloudSpokes
CloudSpokes is a crowdsourcing development community
where members compete in design, coding and alg...
Why build an API?
 IT departments can provide limited access
to internal development teams without
exposing the implement...
Why choose Force.com?
 Build your business logic in Apex
 Declarative development
 Security – FTW!
 No admin UI to dev...
Why choose Heroku?
 Polyglot platform
 Scale up and down rapidly
 Distributed development with Git
 Fork applications ...
Designing your API
Developers want the following:
 Simple, intuitive and easy to learn
 Great documentation
 Code sampl...
Building your API
Adopt web standards. Don’t reinvent the wheel.
 REST
 JSON
 OAuth2
Use proper REST principles
Nouns are good. Verbs are bad.
Other API design considerations
 HTTP response and error codes
• 200, 400, 401, 404 & 500

 Versioning (header vs. URL)
...
Which development language is best?
Language specific REST wrappers for Force.com as well as tools
to make it easier to bu...
Apex REST Services vs. REST API
The REST API is great for interacting with records while Apex
REST Services can encapsulat...
Let’s build an API!
User authentication
Authenticate your API with Force.com
 Single “shared” user
 Named user
• Security
• Chatter
• Audit ...
Best practices
 Prototype with REST API then refactor to Apex REST Services
 Caching is cheap and fast with Memcache and...
Development tools
 Workbench
 Runscope for debugging, testing and sharing API calls
 Chrome extensions: Postman, REST C...
Force.com Gotchas!
 Salesforce.com maintenance downtime
 Sandbox refreshes and upgrades
 Hard to write API unit tests a...
Jeff Douglas
CloudSpokes Platform
Architect,
@jeffdonthemic
Build your API with Force.com and Heroku
Upcoming SlideShare
Loading in …5
×

Build your API with Force.com and Heroku

16,162 views

Published on

Dreamforce 13 Presentation

Published in: Technology, Design
  • Be the first to comment

Build your API with Force.com and Heroku

  1. 1. Build your API with Force.com & Heroku Jeff Douglas, Appirio, CloudSpokes Platform Architect @jeffdonthemic
  2. 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 product or service availability, 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, new products and services, 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, the outcome of any litigation, risks associated with completed and any 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 and in our quarterly report on Form 10-Q for the most recent fiscal quarter. These documents and others containing important disclosures 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 presentations, 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. 3. Jeff Douglas CloudSpokes Platform Architect @jeffdonthemic
  4. 4. All about CloudSpokes CloudSpokes is a crowdsourcing development community where members compete in design, coding and algorithm challenges for cash, prizes, badges and bragging rights.  ~600,000 member community  40-60 development challenges in-flight at any one time  Force.com platform manages members, challenges, payments, etc.  API calls Force.com via REST and JSON
  5. 5. Why build an API?  IT departments can provide limited access to internal development teams without exposing the implementation details of Salesforce.com  ISVs can better serve existing customers by extending their platform  Startups and entrepreneurs can build their business upon Force.com
  6. 6. Why choose Force.com?  Build your business logic in Apex  Declarative development  Security – FTW!  No admin UI to develop and maintain  New features three times a year  Sandbox environments, tools, deployment processes, etc.  Reports & dashboards
  7. 7. Why choose Heroku?  Polyglot platform  Scale up and down rapidly  Distributed development with Git  Fork applications for testing, QA, etc.  Postgres database (fork, follow, share)  Heroku add-ons  Free to get started  Excellent support
  8. 8. Designing your API Developers want the following:  Simple, intuitive and easy to learn  Great documentation  Code samples  Test cases
  9. 9. Building your API Adopt web standards. Don’t reinvent the wheel.  REST  JSON  OAuth2
  10. 10. Use proper REST principles Nouns are good. Verbs are bad.
  11. 11. Other API design considerations  HTTP response and error codes • 200, 400, 401, 404 & 500  Versioning (header vs. URL)  Key management & security  Hide complexity behind “?” Poor design: /challenges/open/5 Better design: /challenges?status=open&limit=5 Teach a Dog to REST
  12. 12. Which development language is best? Language specific REST wrappers for Force.com as well as tools to make it easier to build well-designed APIs.  Ruby • restforce gem, forcifier gem • Rocket_pants, Grape  Node.js • nforce package, forcifier-node package • Actionhero, Restify, Express  Java • Play!, Jersey
  13. 13. Apex REST Services vs. REST API The REST API is great for interacting with records while Apex REST Services can encapsulate numerous operations into a single request.  Design to run as quickly as possible  Handoff long running requests to asynchronous processes
  14. 14. Let’s build an API!
  15. 15. User authentication Authenticate your API with Force.com  Single “shared” user  Named user • Security • Chatter • Audit trail & history • Record ownership
  16. 16. Best practices  Prototype with REST API then refactor to Apex REST Services  Caching is cheap and fast with Memcache and redis  Sync to local datastore with Cloudconnect.com  “Listen” for record changes using the Streaming API  Think about how to version Apex classes, triggers and workflows
  17. 17. Development tools  Workbench  Runscope for debugging, testing and sharing API calls  Chrome extensions: Postman, REST Console  Documenting and testing calls with IODocs, Swagger and Apiary.io
  18. 18. Force.com Gotchas!  Salesforce.com maintenance downtime  Sandbox refreshes and upgrades  Hard to write API unit tests against sandbox environments
  19. 19. Jeff Douglas CloudSpokes Platform Architect, @jeffdonthemic

×