Webcast Series: API Facade Patterns Episode 1 Composition Episode 2 Session Management Episode 3 One Phase to Two Phase Conversion Episode 4 Synchronous to Asynchronous
Episode 1 : Composition Pattern Problem Solution Benefits Considerations
Scenario: Mash-up App Service 1 Service 2 Client App on device Service 3
Problem Establish device connection to three hosts Negotiate API/Service security each time Normalize data format inside the app logic on the device
Multiple Service Mash-up Service 1 Network connection, negotiate security, data format & parsing Network connection, negotiate security, data format & parsing Service 2 Network con Client App nection on device , negotiate security, data format & parsing Service 3
API Service Layer Service 1 API Service Service 2 Layer Client Service 3
An Example Service 1 1. Get Location Book a Cab App API 2. Book Cab Service Service 2 Layer 3. S U t s o Client e re r
P B r o o o fi k le ing History for Service 3
One-time authentication by the device.
Fewer network calls from a device.
Plug in a different service provider without having to change the app.
Validate and control before the requests reach the backend.
Request payload manipulation.
Opportunity to use Backend-as-a-Service with no additional expense to the application logic.
Few other scenarios Parallel callouts Compensation Chatty Services
Parallel Callouts Service API Book a Cab App from Service present location Layer Client Service
Another Example: Chatty Services 1. Get user attributes 2. Get recommended topics Service Provider 3. Get recommended books Client
Solution: Reduce Chattiness 1. Authenticate by API key API Get a recommended 2. Get relevant user topics Service Service book for a user 2 Layer 3. Get recommended books Client
THANK YOU Subscribe to API webcasts at: youtube.com/apigee
THANK YOU Questions and ideas to: groups.google.com/group/api-craft