Build your API with Force.com and Heroku
-
Upload
jeff-douglas -
Category
Technology
-
view
2.193 -
download
4
description
Transcript of Build your API with Force.com and Heroku
Build your API with Force.com &HerokuBuild your API with Force.com &Heroku
Jeff Douglas, Appirio, CloudSpokes Platform Architect
@jeffdonthemic
Safe harborSafe 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.
Jeff DouglasJeff Douglas
CloudSpokes Platform Architect
@jeffdonthemic
CloudSpokes Platform Architect
@jeffdonthemic
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
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
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
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
Designing your API
Simple, intuitive and easy to learn
Great documentation
Code samples
Test cases
Developers want the following:
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)
Key management & security
Hide complexity behind “?”
Teach a Dog to REST
Poor design: /challenges/open/5
Better design: /challenges?status=open&limit=5
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
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
Let’s build an API!
User authentication
Authenticate your API with Force.com
Single “shared” user
Named user• Security
• Chatter
• Audit trail & history
• Record ownership
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
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
Force.com Gotchas!
Salesforce.com maintenance downtime
Sandbox refreshes and upgrades
Hard to write API unit tests against sandbox environments
Jeff DouglasJeff Douglas
CloudSpokes Platform Architect,
@jeffdonthemic