SlideShare a Scribd company logo
The Anatomy of Apps
How iPhone, Android & Facebook Apps Consume APIs

Ed Anuff
@edanuff

Sam Ramji
@sramji

Brian Mulloy
@landlessness                                       Apigee
                                                   @apigee
groups.google.com/group/api-craft
youtube.com/apigee
New!

       IRC Channel
         #api-craft
App    App             App       World of          API   Internal
               App                          API
User   Store         Developer    APIs            Team   Systems
Dogs API

/dogs

/owners



Authorization

OAuth 2.0




RESTful API Design - Second Edition
http://www.youtube.com/watch?v=QpAhXa12xvU
Build an iPhone App, an Android App and a
Facebook Web App*




*Ruby on Rails app hosted on Heroku
http://devcenter.heroku.com/articles/facebook
App    App             App       World of          API   Internal
               App                          API
User   Store         Developer    APIs            Team   Systems
Start with a basic HTTP request
Android

HttpClient client = new DefaultHttpClient();
HttpGet httpGet = new HttpGet("http://api.apizoo.com/v1/dogs");
HttpResponse response = client.execute(httpGet);



iOS

NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL
  URLWithString:@"http://api.apizoo.com/v1/dogs"]];
NSData *response = [NSURLConnection sendSynchronousRequest:request
  returningResponse:nil error:nil];



Ruby on Rails

require 'net/http'
response = Net::HTTP.get(‘api.apizoo.com/v1’, ‘/dogs’)
Parse the data
Android

JSONObject dogs = new JSONObject(response);




iOS

import "JSONKit.h"
NSDictionary *dogs = [response objectFromData];




Ruby on Rails

require 'yajl'
parser = Yajl::Parser.new
dogs = parser.parse(response) # returns a hash
Resource Object Mapping
Route
Map
Use
Android Spring Mobile




Route
requestEntity = new HttpEntity<Object>(requestHeaders);
ResponseEntity<Dog> responseEntity =
   restTemplate.exchange("http://api.apizoo.com/v1/dogs/15", HttpMethod.GET,
   requestEntity, Dog.class);
Android Spring Mobile




Map
// Handled with introspection
Android Spring Mobile




Use
Dog dog = responseEntity.getBody()
iOS RestKit

Route

#import <RestKit/RestKit.h>
RKObjectManager* manager = [RKObjectManager
   objectManagerWithBaseURL:@"http://api.apizoo.com/v1"];
RKDynamicRouter* router = [[RKDynamicRouter new] autorelease];
manager.router = router;

[router routeClass:[Dog class] toResourcePath:@"/dogs"
   forMethod:RKRequestMethodPOST];
[router routeClass:[Dog class] toResourcePath:@"/dogs/(dogID)"];
iOS RestKit



Map

@implementation Dog
+ (NSDictionary*)elementToPropertyMappings {
   return [NSDictionary dictionaryWithKeysAndObjects:
        @"name", @"color", nil];
}
@end
iOS RestKit


Use

Dog* dog = [Dog object];
dog.name = @"Rover";
Dog.color = @"red";

[[RKObjectManager sharedManager] postObject:dog delegate:self];

[[RKObjectManager sharedManager] deleteObject:dog delegate:self];
Ruby on Rails ActiveResource




Route

resource :dogs
Ruby on Rails ActiveResource




Map

class Dog < ActiveResource::Base
 self.site = "http://api.apizoo.com/v1"
end
Ruby on Rails ActiveResource




Use

dog = Dog.new name: ‘Rover’, color: ‘red’

dog.save

dog.destroy
Cache the response in a database
Android Jersey + Jackson




Usage
Roll your own
iOS RestKit + Core Data


Usage

#import <RestKit/CoreData/CoreData.h>
RKObjectManager* manager = [RKObjectManager
   objectManagerWithBaseURL:@"http://api.apizoo.com/v1"];
manager.objectStore = [RKManagedObjectStore
   objectStoreWithStoreFilename:@"DogApp.sqlite"];

@implementation Dog
 + (NSString*)primaryKeyProperty {
   return @"dogID";
 }
@end
Ruby on Rails ActiveResource + ActiveRecord


Usage

class DogResource < ActiveResource::Base
 self.site = http://api.apizoo.com/v1
end

class Dog < ActiveRecord::Base
 # the before methods call DogResource methods
 before_create :create_resource
 before_update :update_resource
 before_destroy :destroy_resource
end
Simple to do list
Problem: we want new capabilities in our app not
supported by APIs.
Usergrid - Data & Queries
http://www.youtube.com/watch?v=zLl56sU5Bt0
Android

usergrid_ sdk




iOS

Use RESTKit




Ruby on Rails

Probably not applicable
What about offline cases
Android

Roll your own


iOS

-(BOOL)reachable {
Reachability *r = [Reachability
    reachabilityWithHostName:@"api.apizoo.com/v1"];
NetworkStatus internetStatus = [r currentReachabilityStatus];
if(internetStatus == NotReachable) {
 return NO;
}
return YES;
}



Ruby on Rails

Probably not applicable
Get authorization out of the way




Assumption: the APIs we consume use OAuth 2
Android

Roll your own
iOS RestKit

RKObjectManager* objectManager = [RKObjectManager sharedManager];
objectManager.client.baseURL = @”api.apizoo.com/v1";
objectManager.client.OAuth2AccessToken = @"YOUR ACCESS TOKEN";
objectManager.client.authenticationType =
  RKRequestAuthenticationTypeOAuth2;
Ruby on Rails Oauth Gem

@consumer=OAuth::Consumer.new("key","secret", site: "api.apizoo.com/v1")
@request_token=@consumer.get_request_token
session[:request_token]=@request_token
redirect_to @request_token.authorize_url
@access_token=@request_token.get_access_token
Android
Built-in JSON, etc.
Spring Mobile (bundles Jersey & Jackson)

iOS
JSONKit
RestKit
Core Data

Ruby on Rails
YAJL
ActiveResource
Oauth
Coming Up: March Miniseries on Apps & APIs
Questions?
THANK YOU
Subscribe to API webinars at:
youtube.com/apigee
THANK YOU
Chat on IRC
#api-craft
THANK YOU
Questions and ideas to:
groups.google.com/group/api-craft
THANK YOU
Contact us at:

@edanuff
ed@apigee.com


@sramji
sramji@apigee.com

@landlessness
brian@apigee.com

More Related Content

Viewers also liked

Visbility at the Edge - Deep Insights from Your API
 Visbility at the Edge - Deep Insights from Your API Visbility at the Edge - Deep Insights from Your API
Visbility at the Edge - Deep Insights from Your API
Apigee | Google Cloud
 
Skeuomorphs, Databases, and Mobile Performance
Skeuomorphs, Databases, and Mobile PerformanceSkeuomorphs, Databases, and Mobile Performance
Skeuomorphs, Databases, and Mobile PerformanceApigee | Google Cloud
 
HTML5: The Apps, the Frameworks, the Controversy
HTML5: The Apps, the Frameworks, the Controversy HTML5: The Apps, the Frameworks, the Controversy
HTML5: The Apps, the Frameworks, the Controversy Apigee | Google Cloud
 
The API Facade Pattern: People - Episode 4
The API Facade Pattern: People - Episode 4The API Facade Pattern: People - Episode 4
The API Facade Pattern: People - Episode 4
Apigee | Google Cloud
 
Crafting APIs for Mobile Apps - Everything You Need to Know
Crafting APIs for Mobile Apps - Everything You Need to KnowCrafting APIs for Mobile Apps - Everything You Need to Know
Crafting APIs for Mobile Apps - Everything You Need to KnowApigee | Google Cloud
 
Essential API Facade Patterns: One Phase to Two Phase Conversion (Episode 3)
Essential API Facade Patterns: One Phase to Two Phase Conversion (Episode 3)Essential API Facade Patterns: One Phase to Two Phase Conversion (Episode 3)
Essential API Facade Patterns: One Phase to Two Phase Conversion (Episode 3)Apigee | Google Cloud
 
Essential API Facade Patterns: Synchronous to Asynchronous Conversion (Episod...
Essential API Facade Patterns: Synchronous to Asynchronous Conversion (Episod...Essential API Facade Patterns: Synchronous to Asynchronous Conversion (Episod...
Essential API Facade Patterns: Synchronous to Asynchronous Conversion (Episod...Apigee | Google Cloud
 
Building your first Native iOs App with an API Backend
Building your first Native iOs App with an API BackendBuilding your first Native iOs App with an API Backend
Building your first Native iOs App with an API BackendApigee | Google Cloud
 
Driving Digital Success: Three ROI Criteria for Competitive Advantage
Driving Digital Success:  Three ROI Criteria for Competitive Advantage Driving Digital Success:  Three ROI Criteria for Competitive Advantage
Driving Digital Success: Three ROI Criteria for Competitive Advantage Apigee | Google Cloud
 
The API Facade Pattern: Common Patterns - Episode 2
The API Facade Pattern: Common Patterns - Episode 2The API Facade Pattern: Common Patterns - Episode 2
The API Facade Pattern: Common Patterns - Episode 2
Apigee | Google Cloud
 
The New 3-Tier Architecture: HTML5, Proxies, and APIs
The New 3-Tier Architecture: HTML5, Proxies, and APIsThe New 3-Tier Architecture: HTML5, Proxies, and APIs
The New 3-Tier Architecture: HTML5, Proxies, and APIsApigee | Google Cloud
 
Essential API Facade Patterns: Session Management (Episode 2)
Essential API Facade Patterns: Session Management (Episode 2)Essential API Facade Patterns: Session Management (Episode 2)
Essential API Facade Patterns: Session Management (Episode 2)Apigee | Google Cloud
 
The Walgreens Story: Putting an API Around Their Stores (Webcast)
The Walgreens Story: Putting an API Around Their Stores (Webcast)The Walgreens Story: Putting an API Around Their Stores (Webcast)
The Walgreens Story: Putting an API Around Their Stores (Webcast)
Apigee | Google Cloud
 
Telco Innovation with APIs - Need for speed (Webcast)
Telco Innovation with APIs - Need for speed (Webcast) Telco Innovation with APIs - Need for speed (Webcast)
Telco Innovation with APIs - Need for speed (Webcast) Apigee | Google Cloud
 
APIs Inside Enterprise - SOA Displacement?
APIs Inside Enterprise - SOA Displacement?APIs Inside Enterprise - SOA Displacement?
APIs Inside Enterprise - SOA Displacement?Apigee | Google Cloud
 
DevOps & Apps - Building and Operating Successful Mobile Apps
DevOps & Apps - Building and Operating Successful Mobile AppsDevOps & Apps - Building and Operating Successful Mobile Apps
DevOps & Apps - Building and Operating Successful Mobile AppsApigee | Google Cloud
 
Economic Models for Reinventing Telco - Innovation with APIs
Economic Models for Reinventing Telco - Innovation with APIsEconomic Models for Reinventing Telco - Innovation with APIs
Economic Models for Reinventing Telco - Innovation with APIsApigee | Google Cloud
 
API Management for Software Defined Network (SDN)
API Management for Software Defined Network (SDN)API Management for Software Defined Network (SDN)
API Management for Software Defined Network (SDN)Apigee | Google Cloud
 
OData Introduction and Impact on API Design (Webcast)
OData Introduction and Impact on API Design (Webcast)OData Introduction and Impact on API Design (Webcast)
OData Introduction and Impact on API Design (Webcast)
Apigee | Google Cloud
 
APIs & Copyrights
APIs & CopyrightsAPIs & Copyrights
APIs & Copyrights
Apigee | Google Cloud
 

Viewers also liked (20)

Visbility at the Edge - Deep Insights from Your API
 Visbility at the Edge - Deep Insights from Your API Visbility at the Edge - Deep Insights from Your API
Visbility at the Edge - Deep Insights from Your API
 
Skeuomorphs, Databases, and Mobile Performance
Skeuomorphs, Databases, and Mobile PerformanceSkeuomorphs, Databases, and Mobile Performance
Skeuomorphs, Databases, and Mobile Performance
 
HTML5: The Apps, the Frameworks, the Controversy
HTML5: The Apps, the Frameworks, the Controversy HTML5: The Apps, the Frameworks, the Controversy
HTML5: The Apps, the Frameworks, the Controversy
 
The API Facade Pattern: People - Episode 4
The API Facade Pattern: People - Episode 4The API Facade Pattern: People - Episode 4
The API Facade Pattern: People - Episode 4
 
Crafting APIs for Mobile Apps - Everything You Need to Know
Crafting APIs for Mobile Apps - Everything You Need to KnowCrafting APIs for Mobile Apps - Everything You Need to Know
Crafting APIs for Mobile Apps - Everything You Need to Know
 
Essential API Facade Patterns: One Phase to Two Phase Conversion (Episode 3)
Essential API Facade Patterns: One Phase to Two Phase Conversion (Episode 3)Essential API Facade Patterns: One Phase to Two Phase Conversion (Episode 3)
Essential API Facade Patterns: One Phase to Two Phase Conversion (Episode 3)
 
Essential API Facade Patterns: Synchronous to Asynchronous Conversion (Episod...
Essential API Facade Patterns: Synchronous to Asynchronous Conversion (Episod...Essential API Facade Patterns: Synchronous to Asynchronous Conversion (Episod...
Essential API Facade Patterns: Synchronous to Asynchronous Conversion (Episod...
 
Building your first Native iOs App with an API Backend
Building your first Native iOs App with an API BackendBuilding your first Native iOs App with an API Backend
Building your first Native iOs App with an API Backend
 
Driving Digital Success: Three ROI Criteria for Competitive Advantage
Driving Digital Success:  Three ROI Criteria for Competitive Advantage Driving Digital Success:  Three ROI Criteria for Competitive Advantage
Driving Digital Success: Three ROI Criteria for Competitive Advantage
 
The API Facade Pattern: Common Patterns - Episode 2
The API Facade Pattern: Common Patterns - Episode 2The API Facade Pattern: Common Patterns - Episode 2
The API Facade Pattern: Common Patterns - Episode 2
 
The New 3-Tier Architecture: HTML5, Proxies, and APIs
The New 3-Tier Architecture: HTML5, Proxies, and APIsThe New 3-Tier Architecture: HTML5, Proxies, and APIs
The New 3-Tier Architecture: HTML5, Proxies, and APIs
 
Essential API Facade Patterns: Session Management (Episode 2)
Essential API Facade Patterns: Session Management (Episode 2)Essential API Facade Patterns: Session Management (Episode 2)
Essential API Facade Patterns: Session Management (Episode 2)
 
The Walgreens Story: Putting an API Around Their Stores (Webcast)
The Walgreens Story: Putting an API Around Their Stores (Webcast)The Walgreens Story: Putting an API Around Their Stores (Webcast)
The Walgreens Story: Putting an API Around Their Stores (Webcast)
 
Telco Innovation with APIs - Need for speed (Webcast)
Telco Innovation with APIs - Need for speed (Webcast) Telco Innovation with APIs - Need for speed (Webcast)
Telco Innovation with APIs - Need for speed (Webcast)
 
APIs Inside Enterprise - SOA Displacement?
APIs Inside Enterprise - SOA Displacement?APIs Inside Enterprise - SOA Displacement?
APIs Inside Enterprise - SOA Displacement?
 
DevOps & Apps - Building and Operating Successful Mobile Apps
DevOps & Apps - Building and Operating Successful Mobile AppsDevOps & Apps - Building and Operating Successful Mobile Apps
DevOps & Apps - Building and Operating Successful Mobile Apps
 
Economic Models for Reinventing Telco - Innovation with APIs
Economic Models for Reinventing Telco - Innovation with APIsEconomic Models for Reinventing Telco - Innovation with APIs
Economic Models for Reinventing Telco - Innovation with APIs
 
API Management for Software Defined Network (SDN)
API Management for Software Defined Network (SDN)API Management for Software Defined Network (SDN)
API Management for Software Defined Network (SDN)
 
OData Introduction and Impact on API Design (Webcast)
OData Introduction and Impact on API Design (Webcast)OData Introduction and Impact on API Design (Webcast)
OData Introduction and Impact on API Design (Webcast)
 
APIs & Copyrights
APIs & CopyrightsAPIs & Copyrights
APIs & Copyrights
 

Similar to The Anatomy of Apps - How iPhone, Android & Facebook Apps Consume APIs

Design & Deploy a data-driven Web API in 2 hours
Design & Deploy a data-driven Web API in 2 hoursDesign & Deploy a data-driven Web API in 2 hours
Design & Deploy a data-driven Web API in 2 hours
Restlet
 
iOS Swift application architecture
iOS Swift application architectureiOS Swift application architecture
iOS Swift application architecture
Romain Rochegude
 
Lecture 12 - Maps, AR_VR_aaaaHardware.pptx
Lecture 12 - Maps, AR_VR_aaaaHardware.pptxLecture 12 - Maps, AR_VR_aaaaHardware.pptx
Lecture 12 - Maps, AR_VR_aaaaHardware.pptx
NgLQun
 
Creating REST Applications with the Slim Micro-Framework by Vikram Vaswani
Creating REST Applications with the Slim Micro-Framework by Vikram VaswaniCreating REST Applications with the Slim Micro-Framework by Vikram Vaswani
Creating REST Applications with the Slim Micro-Framework by Vikram Vaswani
vvaswani
 
Playing with parse.com
Playing with parse.comPlaying with parse.com
Playing with parse.com
JUG Genova
 
All a flutter about Flutter.io
All a flutter about Flutter.ioAll a flutter about Flutter.io
All a flutter about Flutter.io
Steven Cooper
 
Using Ruby in Android Development
Using Ruby in Android DevelopmentUsing Ruby in Android Development
Using Ruby in Android Development
Adam Blum
 
Java Libraries You Can’t Afford to Miss
Java Libraries You Can’t Afford to Miss Java Libraries You Can’t Afford to Miss
Java Libraries You Can’t Afford to Miss
Andres Almiray
 
Appium Overview - by Daniel Puterman
Appium Overview - by Daniel PutermanAppium Overview - by Daniel Puterman
Appium Overview - by Daniel Puterman
Applitools
 
Android intermediatte Full
Android intermediatte FullAndroid intermediatte Full
Android intermediatte Full
Ahmad Arif Faizin
 
REST API for your WP7 App
REST API for your WP7 AppREST API for your WP7 App
REST API for your WP7 App
Agnius Paradnikas
 
Building Better Web APIs with Rails
Building Better Web APIs with RailsBuilding Better Web APIs with Rails
Building Better Web APIs with Rails
All Things Open
 
Retrofit Library In Android
Retrofit Library In AndroidRetrofit Library In Android
Retrofit Library In Android
InnovationM
 
Java Libraries You Can't Afford to Miss
Java Libraries You Can't Afford to MissJava Libraries You Can't Afford to Miss
Java Libraries You Can't Afford to Miss
Andres Almiray
 
Android & iOS Automation Using Appium
Android & iOS Automation Using AppiumAndroid & iOS Automation Using Appium
Android & iOS Automation Using Appium
Mindfire Solutions
 
Appium
AppiumAppium
App engine ja night 9 beertalk2
App engine ja night 9 beertalk2App engine ja night 9 beertalk2
App engine ja night 9 beertalk2
SATOSHI TAGOMORI
 
Android Workshop
Android WorkshopAndroid Workshop
Android Workshop
Junda Ong
 

Similar to The Anatomy of Apps - How iPhone, Android & Facebook Apps Consume APIs (20)

Bpstudy20101221
Bpstudy20101221Bpstudy20101221
Bpstudy20101221
 
Design & Deploy a data-driven Web API in 2 hours
Design & Deploy a data-driven Web API in 2 hoursDesign & Deploy a data-driven Web API in 2 hours
Design & Deploy a data-driven Web API in 2 hours
 
iOS Swift application architecture
iOS Swift application architectureiOS Swift application architecture
iOS Swift application architecture
 
Lecture 12 - Maps, AR_VR_aaaaHardware.pptx
Lecture 12 - Maps, AR_VR_aaaaHardware.pptxLecture 12 - Maps, AR_VR_aaaaHardware.pptx
Lecture 12 - Maps, AR_VR_aaaaHardware.pptx
 
Creating REST Applications with the Slim Micro-Framework by Vikram Vaswani
Creating REST Applications with the Slim Micro-Framework by Vikram VaswaniCreating REST Applications with the Slim Micro-Framework by Vikram Vaswani
Creating REST Applications with the Slim Micro-Framework by Vikram Vaswani
 
Playing with parse.com
Playing with parse.comPlaying with parse.com
Playing with parse.com
 
All a flutter about Flutter.io
All a flutter about Flutter.ioAll a flutter about Flutter.io
All a flutter about Flutter.io
 
Using Ruby in Android Development
Using Ruby in Android DevelopmentUsing Ruby in Android Development
Using Ruby in Android Development
 
Java Libraries You Can’t Afford to Miss
Java Libraries You Can’t Afford to Miss Java Libraries You Can’t Afford to Miss
Java Libraries You Can’t Afford to Miss
 
Appium Overview - by Daniel Puterman
Appium Overview - by Daniel PutermanAppium Overview - by Daniel Puterman
Appium Overview - by Daniel Puterman
 
Android intermediatte Full
Android intermediatte FullAndroid intermediatte Full
Android intermediatte Full
 
REST API for your WP7 App
REST API for your WP7 AppREST API for your WP7 App
REST API for your WP7 App
 
Oracle APEX & PhoneGap
Oracle APEX & PhoneGapOracle APEX & PhoneGap
Oracle APEX & PhoneGap
 
Building Better Web APIs with Rails
Building Better Web APIs with RailsBuilding Better Web APIs with Rails
Building Better Web APIs with Rails
 
Retrofit Library In Android
Retrofit Library In AndroidRetrofit Library In Android
Retrofit Library In Android
 
Java Libraries You Can't Afford to Miss
Java Libraries You Can't Afford to MissJava Libraries You Can't Afford to Miss
Java Libraries You Can't Afford to Miss
 
Android & iOS Automation Using Appium
Android & iOS Automation Using AppiumAndroid & iOS Automation Using Appium
Android & iOS Automation Using Appium
 
Appium
AppiumAppium
Appium
 
App engine ja night 9 beertalk2
App engine ja night 9 beertalk2App engine ja night 9 beertalk2
App engine ja night 9 beertalk2
 
Android Workshop
Android WorkshopAndroid Workshop
Android Workshop
 

More from Apigee | Google Cloud

How Secure Are Your APIs?
How Secure Are Your APIs?How Secure Are Your APIs?
How Secure Are Your APIs?
Apigee | Google Cloud
 
Magazine Luiza at a glance (1)
Magazine Luiza at a glance (1)Magazine Luiza at a glance (1)
Magazine Luiza at a glance (1)
Apigee | Google Cloud
 
Monetization: Unlock More Value from Your APIs
Monetization: Unlock More Value from Your APIs Monetization: Unlock More Value from Your APIs
Monetization: Unlock More Value from Your APIs
Apigee | Google Cloud
 
Apigee Demo: API Platform Overview
Apigee Demo: API Platform OverviewApigee Demo: API Platform Overview
Apigee Demo: API Platform Overview
Apigee | Google Cloud
 
Ticketmaster at a glance
Ticketmaster at a glanceTicketmaster at a glance
Ticketmaster at a glance
Apigee | Google Cloud
 
AccuWeather: Recasting API Experiences in a Developer-First World
AccuWeather: Recasting API Experiences in a Developer-First WorldAccuWeather: Recasting API Experiences in a Developer-First World
AccuWeather: Recasting API Experiences in a Developer-First World
Apigee | Google Cloud
 
Which Application Modernization Pattern Is Right For You?
Which Application Modernization Pattern Is Right For You?Which Application Modernization Pattern Is Right For You?
Which Application Modernization Pattern Is Right For You?
Apigee | Google Cloud
 
Apigee Product Roadmap Part 2
Apigee Product Roadmap Part 2Apigee Product Roadmap Part 2
Apigee Product Roadmap Part 2
Apigee | Google Cloud
 
The Four Transformative Forces of the API Management Market
The Four Transformative Forces of the API Management MarketThe Four Transformative Forces of the API Management Market
The Four Transformative Forces of the API Management Market
Apigee | Google Cloud
 
Walgreens at a glance
Walgreens at a glanceWalgreens at a glance
Walgreens at a glance
Apigee | Google Cloud
 
Apigee Edge: Intro to Microgateway
Apigee Edge: Intro to MicrogatewayApigee Edge: Intro to Microgateway
Apigee Edge: Intro to Microgateway
Apigee | Google Cloud
 
Managing the Complexity of Microservices Deployments
Managing the Complexity of Microservices DeploymentsManaging the Complexity of Microservices Deployments
Managing the Complexity of Microservices Deployments
Apigee | Google Cloud
 
Pitney Bowes at a glance
Pitney Bowes at a glancePitney Bowes at a glance
Pitney Bowes at a glance
Apigee | Google Cloud
 
Microservices Done Right: Key Ingredients for Microservices Success
Microservices Done Right: Key Ingredients for Microservices SuccessMicroservices Done Right: Key Ingredients for Microservices Success
Microservices Done Right: Key Ingredients for Microservices Success
Apigee | Google Cloud
 
Adapt or Die: Opening Keynote with Chet Kapoor
Adapt or Die: Opening Keynote with Chet KapoorAdapt or Die: Opening Keynote with Chet Kapoor
Adapt or Die: Opening Keynote with Chet Kapoor
Apigee | Google Cloud
 
Adapt or Die: Keynote with Greg Brail
Adapt or Die: Keynote with Greg BrailAdapt or Die: Keynote with Greg Brail
Adapt or Die: Keynote with Greg Brail
Apigee | Google Cloud
 
Adapt or Die: Keynote with Anant Jhingran
Adapt or Die: Keynote with Anant JhingranAdapt or Die: Keynote with Anant Jhingran
Adapt or Die: Keynote with Anant Jhingran
Apigee | Google Cloud
 
London Adapt or Die: Opening Keynot
London Adapt or Die: Opening KeynotLondon Adapt or Die: Opening Keynot
London Adapt or Die: Opening Keynot
Apigee | Google Cloud
 
London Adapt or Die: Lunch keynote
London Adapt or Die: Lunch keynoteLondon Adapt or Die: Lunch keynote
London Adapt or Die: Lunch keynote
Apigee | Google Cloud
 
London Adapt or Die: Closing Keynote — Adapt Now!
London Adapt or Die: Closing Keynote — Adapt Now!London Adapt or Die: Closing Keynote — Adapt Now!
London Adapt or Die: Closing Keynote — Adapt Now!
Apigee | Google Cloud
 

More from Apigee | Google Cloud (20)

How Secure Are Your APIs?
How Secure Are Your APIs?How Secure Are Your APIs?
How Secure Are Your APIs?
 
Magazine Luiza at a glance (1)
Magazine Luiza at a glance (1)Magazine Luiza at a glance (1)
Magazine Luiza at a glance (1)
 
Monetization: Unlock More Value from Your APIs
Monetization: Unlock More Value from Your APIs Monetization: Unlock More Value from Your APIs
Monetization: Unlock More Value from Your APIs
 
Apigee Demo: API Platform Overview
Apigee Demo: API Platform OverviewApigee Demo: API Platform Overview
Apigee Demo: API Platform Overview
 
Ticketmaster at a glance
Ticketmaster at a glanceTicketmaster at a glance
Ticketmaster at a glance
 
AccuWeather: Recasting API Experiences in a Developer-First World
AccuWeather: Recasting API Experiences in a Developer-First WorldAccuWeather: Recasting API Experiences in a Developer-First World
AccuWeather: Recasting API Experiences in a Developer-First World
 
Which Application Modernization Pattern Is Right For You?
Which Application Modernization Pattern Is Right For You?Which Application Modernization Pattern Is Right For You?
Which Application Modernization Pattern Is Right For You?
 
Apigee Product Roadmap Part 2
Apigee Product Roadmap Part 2Apigee Product Roadmap Part 2
Apigee Product Roadmap Part 2
 
The Four Transformative Forces of the API Management Market
The Four Transformative Forces of the API Management MarketThe Four Transformative Forces of the API Management Market
The Four Transformative Forces of the API Management Market
 
Walgreens at a glance
Walgreens at a glanceWalgreens at a glance
Walgreens at a glance
 
Apigee Edge: Intro to Microgateway
Apigee Edge: Intro to MicrogatewayApigee Edge: Intro to Microgateway
Apigee Edge: Intro to Microgateway
 
Managing the Complexity of Microservices Deployments
Managing the Complexity of Microservices DeploymentsManaging the Complexity of Microservices Deployments
Managing the Complexity of Microservices Deployments
 
Pitney Bowes at a glance
Pitney Bowes at a glancePitney Bowes at a glance
Pitney Bowes at a glance
 
Microservices Done Right: Key Ingredients for Microservices Success
Microservices Done Right: Key Ingredients for Microservices SuccessMicroservices Done Right: Key Ingredients for Microservices Success
Microservices Done Right: Key Ingredients for Microservices Success
 
Adapt or Die: Opening Keynote with Chet Kapoor
Adapt or Die: Opening Keynote with Chet KapoorAdapt or Die: Opening Keynote with Chet Kapoor
Adapt or Die: Opening Keynote with Chet Kapoor
 
Adapt or Die: Keynote with Greg Brail
Adapt or Die: Keynote with Greg BrailAdapt or Die: Keynote with Greg Brail
Adapt or Die: Keynote with Greg Brail
 
Adapt or Die: Keynote with Anant Jhingran
Adapt or Die: Keynote with Anant JhingranAdapt or Die: Keynote with Anant Jhingran
Adapt or Die: Keynote with Anant Jhingran
 
London Adapt or Die: Opening Keynot
London Adapt or Die: Opening KeynotLondon Adapt or Die: Opening Keynot
London Adapt or Die: Opening Keynot
 
London Adapt or Die: Lunch keynote
London Adapt or Die: Lunch keynoteLondon Adapt or Die: Lunch keynote
London Adapt or Die: Lunch keynote
 
London Adapt or Die: Closing Keynote — Adapt Now!
London Adapt or Die: Closing Keynote — Adapt Now!London Adapt or Die: Closing Keynote — Adapt Now!
London Adapt or Die: Closing Keynote — Adapt Now!
 

Recently uploaded

JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
Abida Shariff
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 

Recently uploaded (20)

JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 

The Anatomy of Apps - How iPhone, Android & Facebook Apps Consume APIs

  • 1. The Anatomy of Apps How iPhone, Android & Facebook Apps Consume APIs Ed Anuff @edanuff Sam Ramji @sramji Brian Mulloy @landlessness Apigee @apigee
  • 4. New! IRC Channel #api-craft
  • 5. App App App World of API Internal App API User Store Developer APIs Team Systems
  • 6. Dogs API /dogs /owners Authorization OAuth 2.0 RESTful API Design - Second Edition http://www.youtube.com/watch?v=QpAhXa12xvU
  • 7. Build an iPhone App, an Android App and a Facebook Web App* *Ruby on Rails app hosted on Heroku http://devcenter.heroku.com/articles/facebook
  • 8. App App App World of API Internal App API User Store Developer APIs Team Systems
  • 9. Start with a basic HTTP request
  • 10. Android HttpClient client = new DefaultHttpClient(); HttpGet httpGet = new HttpGet("http://api.apizoo.com/v1/dogs"); HttpResponse response = client.execute(httpGet); iOS NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://api.apizoo.com/v1/dogs"]]; NSData *response = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil]; Ruby on Rails require 'net/http' response = Net::HTTP.get(‘api.apizoo.com/v1’, ‘/dogs’)
  • 12. Android JSONObject dogs = new JSONObject(response); iOS import "JSONKit.h" NSDictionary *dogs = [response objectFromData]; Ruby on Rails require 'yajl' parser = Yajl::Parser.new dogs = parser.parse(response) # returns a hash
  • 15. Android Spring Mobile Route requestEntity = new HttpEntity<Object>(requestHeaders); ResponseEntity<Dog> responseEntity = restTemplate.exchange("http://api.apizoo.com/v1/dogs/15", HttpMethod.GET, requestEntity, Dog.class);
  • 16. Android Spring Mobile Map // Handled with introspection
  • 17. Android Spring Mobile Use Dog dog = responseEntity.getBody()
  • 18. iOS RestKit Route #import <RestKit/RestKit.h> RKObjectManager* manager = [RKObjectManager objectManagerWithBaseURL:@"http://api.apizoo.com/v1"]; RKDynamicRouter* router = [[RKDynamicRouter new] autorelease]; manager.router = router; [router routeClass:[Dog class] toResourcePath:@"/dogs" forMethod:RKRequestMethodPOST]; [router routeClass:[Dog class] toResourcePath:@"/dogs/(dogID)"];
  • 19. iOS RestKit Map @implementation Dog + (NSDictionary*)elementToPropertyMappings { return [NSDictionary dictionaryWithKeysAndObjects: @"name", @"color", nil]; } @end
  • 20. iOS RestKit Use Dog* dog = [Dog object]; dog.name = @"Rover"; Dog.color = @"red"; [[RKObjectManager sharedManager] postObject:dog delegate:self]; [[RKObjectManager sharedManager] deleteObject:dog delegate:self];
  • 21. Ruby on Rails ActiveResource Route resource :dogs
  • 22. Ruby on Rails ActiveResource Map class Dog < ActiveResource::Base self.site = "http://api.apizoo.com/v1" end
  • 23. Ruby on Rails ActiveResource Use dog = Dog.new name: ‘Rover’, color: ‘red’ dog.save dog.destroy
  • 24. Cache the response in a database
  • 25. Android Jersey + Jackson Usage Roll your own
  • 26. iOS RestKit + Core Data Usage #import <RestKit/CoreData/CoreData.h> RKObjectManager* manager = [RKObjectManager objectManagerWithBaseURL:@"http://api.apizoo.com/v1"]; manager.objectStore = [RKManagedObjectStore objectStoreWithStoreFilename:@"DogApp.sqlite"]; @implementation Dog + (NSString*)primaryKeyProperty { return @"dogID"; } @end
  • 27. Ruby on Rails ActiveResource + ActiveRecord Usage class DogResource < ActiveResource::Base self.site = http://api.apizoo.com/v1 end class Dog < ActiveRecord::Base # the before methods call DogResource methods before_create :create_resource before_update :update_resource before_destroy :destroy_resource end
  • 28. Simple to do list
  • 29. Problem: we want new capabilities in our app not supported by APIs.
  • 30. Usergrid - Data & Queries http://www.youtube.com/watch?v=zLl56sU5Bt0
  • 31. Android usergrid_ sdk iOS Use RESTKit Ruby on Rails Probably not applicable
  • 33. Android Roll your own iOS -(BOOL)reachable { Reachability *r = [Reachability reachabilityWithHostName:@"api.apizoo.com/v1"]; NetworkStatus internetStatus = [r currentReachabilityStatus]; if(internetStatus == NotReachable) { return NO; } return YES; } Ruby on Rails Probably not applicable
  • 34. Get authorization out of the way Assumption: the APIs we consume use OAuth 2
  • 36. iOS RestKit RKObjectManager* objectManager = [RKObjectManager sharedManager]; objectManager.client.baseURL = @”api.apizoo.com/v1"; objectManager.client.OAuth2AccessToken = @"YOUR ACCESS TOKEN"; objectManager.client.authenticationType = RKRequestAuthenticationTypeOAuth2;
  • 37. Ruby on Rails Oauth Gem @consumer=OAuth::Consumer.new("key","secret", site: "api.apizoo.com/v1") @request_token=@consumer.get_request_token session[:request_token]=@request_token redirect_to @request_token.authorize_url @access_token=@request_token.get_access_token
  • 38. Android Built-in JSON, etc. Spring Mobile (bundles Jersey & Jackson) iOS JSONKit RestKit Core Data Ruby on Rails YAJL ActiveResource Oauth
  • 39. Coming Up: March Miniseries on Apps & APIs
  • 41. THANK YOU Subscribe to API webinars at: youtube.com/apigee
  • 42. THANK YOU Chat on IRC #api-craft
  • 43. THANK YOU Questions and ideas to: groups.google.com/group/api-craft
  • 44. THANK YOU Contact us at: @edanuff ed@apigee.com @sramji sramji@apigee.com @landlessness brian@apigee.com

Editor's Notes

  1. Creative Commons Attribution-Share Alike 3.0 United States License
  2. Android &amp; iOS default response is a hash/dictionaryRuby on Rails
  3. Android &amp; iOS default response is a hash/dictionaryRuby on Rails
  4. Android &amp; iOS default response is a hash/dictionaryRuby on Rails
  5. Android &amp; iOS default response is a hash/dictionaryRuby on Rails
  6. Android &amp; iOS default response is a hash/dictionaryRuby on Rails
  7. Android &amp; iOS default response is a hash/dictionaryRuby on Rails
  8. Android &amp; iOS default response is a hash/dictionaryRuby on Rails
  9. Android &amp; iOS default response is a hash/dictionaryRuby on Rails
  10. Android &amp; iOS default response is a hash/dictionaryRuby on Rails
  11. Android &amp; iOS default response is a hash/dictionaryRuby on Rails
  12. Android &amp; iOS default response is a hash/dictionaryRuby on Rails
  13. Android &amp; iOS default response is a hash/dictionaryRuby on Rails
  14. Android &amp; iOS default response is a hash/dictionaryRuby on Rails
  15. iOSFun factoid: the app store will reject your app if you don’t properly test your app using the reachability APIAndroidSearch around for Reachability - Connectivity Manager
  16. If you provide and consume the api then auth is what u make it.Oauth 2 is a standard but not too heavyAbout 70% of the reason folks go to a special purpose built client library is auth, the second is object marshaling.The standard clients start to screw you over…Parameter signing are a nightmare for the app developer. RestKit
  17. AndroidSUN JerseySpring MobileTradeoffs are around the App SizeForOauth: do the flow with the web browser but oauth 2 is a really pragmatic spec you can also pass a username and password. It will be up to the app. Client id and the client token. Get back an access token either in the header or as a param.
  18. AndroidSUN JerseySpring MobileTradeoffs are around the App SizeForOauth: do the flow with the web browser but oauth 2 is a really pragmatic spec you can also pass a username and password. It will be up to the app. Client id and the client token. Get back an access token either in the header or as a param.