Download - REST & API Management with the WSO2 ESB
![Page 1: REST & API Management with the WSO2 ESB](https://reader033.vdocuments.us/reader033/viewer/2022042518/557cf925d8b42a98158b4b51/html5/thumbnails/1.jpg)
REST and API Managementwith
Hiranya JayathilakaProduct Manager – WSO2 ESB
![Page 2: REST & API Management with the WSO2 ESB](https://reader033.vdocuments.us/reader033/viewer/2022042518/557cf925d8b42a98158b4b51/html5/thumbnails/2.jpg)
What is REST?
● REpresentational State Transfer● Lightweight, ClientServer architecture● Interactions are based on the transfer of
resource state representations● Systems exchange state representations and
perform application state transitions● Mostly implemented using HTTP but can be
based on other protocols
![Page 3: REST & API Management with the WSO2 ESB](https://reader033.vdocuments.us/reader033/viewer/2022042518/557cf925d8b42a98158b4b51/html5/thumbnails/3.jpg)
Origin and Growth
● First introduced by Roy Fielding in his doctoral dissertation
● Developed in parallel with HTTP/1.1● WWW is the largest known implementation of a
RESTful architecture● Widely used in modern days as an alternative to
technologies like CORBA and SOAP
![Page 4: REST & API Management with the WSO2 ESB](https://reader033.vdocuments.us/reader033/viewer/2022042518/557cf925d8b42a98158b4b51/html5/thumbnails/4.jpg)
REST By Example...
● Learning Management System for a school● A number of fundamental concepts
● Student● Course● Teacher
● In a RESTful design these concepts are likely to become the 'resources' managed by the LMS
![Page 5: REST & API Management with the WSO2 ESB](https://reader033.vdocuments.us/reader033/viewer/2022042518/557cf925d8b42a98158b4b51/html5/thumbnails/5.jpg)
The 'Student' Resource State
● Name● Index number● Age● Date of birth● Contact information● GPA● ...
![Page 6: REST & API Management with the WSO2 ESB](https://reader033.vdocuments.us/reader033/viewer/2022042518/557cf925d8b42a98158b4b51/html5/thumbnails/6.jpg)
State Representation XML
![Page 7: REST & API Management with the WSO2 ESB](https://reader033.vdocuments.us/reader033/viewer/2022042518/557cf925d8b42a98158b4b51/html5/thumbnails/7.jpg)
State Representation JSON
![Page 8: REST & API Management with the WSO2 ESB](https://reader033.vdocuments.us/reader033/viewer/2022042518/557cf925d8b42a98158b4b51/html5/thumbnails/8.jpg)
Application State
● Applications have states● Number of students in the system● Number of associations between students and
courses● Number of teachers
● Application state transitions may occur as a result of a resource state transfer
● Application state can also be represented using some data format or hyper text references
![Page 9: REST & API Management with the WSO2 ESB](https://reader033.vdocuments.us/reader033/viewer/2022042518/557cf925d8b42a98158b4b51/html5/thumbnails/9.jpg)
Representational State Transfer
● Clients and servers interact with each other by exchanging ● Resource state representations● Application state representations● Other control information
![Page 10: REST & API Management with the WSO2 ESB](https://reader033.vdocuments.us/reader033/viewer/2022042518/557cf925d8b42a98158b4b51/html5/thumbnails/10.jpg)
RESTful Interactions
![Page 11: REST & API Management with the WSO2 ESB](https://reader033.vdocuments.us/reader033/viewer/2022042518/557cf925d8b42a98158b4b51/html5/thumbnails/11.jpg)
Why HTTP?
● Rich vocabulary and powerful tools that are ideal for representing resource states, application states and control data● Application state – Status code + Links● Resource state – HTTP entity● Control data – HTTP method
● CRUD operations map nicely into HTTP methods
![Page 12: REST & API Management with the WSO2 ESB](https://reader033.vdocuments.us/reader033/viewer/2022042518/557cf925d8b42a98158b4b51/html5/thumbnails/12.jpg)
HTTP Based RESTful Interactions
![Page 13: REST & API Management with the WSO2 ESB](https://reader033.vdocuments.us/reader033/viewer/2022042518/557cf925d8b42a98158b4b51/html5/thumbnails/13.jpg)
Advantages
● Simple and lightweight● Easy to implement● Very little processing at the application level● Small amount of data to pass around
● Support any content type● Leverage builtin application layer protocol
semantics without reinventing the wheel
![Page 14: REST & API Management with the WSO2 ESB](https://reader033.vdocuments.us/reader033/viewer/2022042518/557cf925d8b42a98158b4b51/html5/thumbnails/14.jpg)
Notable Deployments
● Amazon AWS (Over 90% of the clients are using the RESTful API)
● Google Maps● Yahoo!● eBay
● Sastry Malladi on service orientation http://www.youtube.com/watch?v=O9osZGXDok
![Page 15: REST & API Management with the WSO2 ESB](https://reader033.vdocuments.us/reader033/viewer/2022042518/557cf925d8b42a98158b4b51/html5/thumbnails/15.jpg)
WSO2 ESB
● A lightweight, highperformance ESB● Feature rich and standards compliant
● SOAP and WS* standards● REST support● Variety of protocols and message formats
● User friendly and highly extensible● 100% free and open source with commercial
support
![Page 16: REST & API Management with the WSO2 ESB](https://reader033.vdocuments.us/reader033/viewer/2022042518/557cf925d8b42a98158b4b51/html5/thumbnails/16.jpg)
Under the Hood
● WSO2 ESB is based on a number of well known Apache projects● Synapse http://synapse.apache.org● Axis2 http://axis.apache.org/axis2/java/core● Web Services http://ws.apache.org
● REST support of WSO2 ESB stems from the REST support offered by Axis2
![Page 17: REST & API Management with the WSO2 ESB](https://reader033.vdocuments.us/reader033/viewer/2022042518/557cf925d8b42a98158b4b51/html5/thumbnails/17.jpg)
REST Support in Axis2
● Axis2 provides a REST binding for each deployed web service
● This enables clients to invoke any Axis2 service via REST calls● GET /services/HelloService/sayHello● GET /services/MathService/add?a=5&b=10
![Page 18: REST & API Management with the WSO2 ESB](https://reader033.vdocuments.us/reader033/viewer/2022042518/557cf925d8b42a98158b4b51/html5/thumbnails/18.jpg)
REST Support in WSO2 ESB
● WSO2 ESB can receive and mediate REST calls just like any other request
● The same mediators that work with SOAP can be used to manipulate REST invocations● Log, Send, Filter, Switch, XSLT, DBLookup....
● Additional handles provided by the ESB in the form of properties
● Easily switch between SOAP and REST
![Page 19: REST & API Management with the WSO2 ESB](https://reader033.vdocuments.us/reader033/viewer/2022042518/557cf925d8b42a98158b4b51/html5/thumbnails/19.jpg)
Exposing a SOAP Service via REST
![Page 20: REST & API Management with the WSO2 ESB](https://reader033.vdocuments.us/reader033/viewer/2022042518/557cf925d8b42a98158b4b51/html5/thumbnails/20.jpg)
Sample Proxy Configuration
![Page 21: REST & API Management with the WSO2 ESB](https://reader033.vdocuments.us/reader033/viewer/2022042518/557cf925d8b42a98158b4b51/html5/thumbnails/21.jpg)
Exposing a REST/POX Service via SOAP
![Page 22: REST & API Management with the WSO2 ESB](https://reader033.vdocuments.us/reader033/viewer/2022042518/557cf925d8b42a98158b4b51/html5/thumbnails/22.jpg)
Sample Proxy Configuration
![Page 23: REST & API Management with the WSO2 ESB](https://reader033.vdocuments.us/reader033/viewer/2022042518/557cf925d8b42a98158b4b51/html5/thumbnails/23.jpg)
Exercising More Control Over REST
● Manipulate REST calls based on● HTTP method● Status code● Content type● HTTP headers
![Page 24: REST & API Management with the WSO2 ESB](https://reader033.vdocuments.us/reader033/viewer/2022042518/557cf925d8b42a98158b4b51/html5/thumbnails/24.jpg)
Accessing HTTP Method
![Page 25: REST & API Management with the WSO2 ESB](https://reader033.vdocuments.us/reader033/viewer/2022042518/557cf925d8b42a98158b4b51/html5/thumbnails/25.jpg)
Examples
![Page 26: REST & API Management with the WSO2 ESB](https://reader033.vdocuments.us/reader033/viewer/2022042518/557cf925d8b42a98158b4b51/html5/thumbnails/26.jpg)
Accessing HTTP Status Codes
![Page 27: REST & API Management with the WSO2 ESB](https://reader033.vdocuments.us/reader033/viewer/2022042518/557cf925d8b42a98158b4b51/html5/thumbnails/27.jpg)
Examples
![Page 28: REST & API Management with the WSO2 ESB](https://reader033.vdocuments.us/reader033/viewer/2022042518/557cf925d8b42a98158b4b51/html5/thumbnails/28.jpg)
Manipulating HTTP Headers
![Page 29: REST & API Management with the WSO2 ESB](https://reader033.vdocuments.us/reader033/viewer/2022042518/557cf925d8b42a98158b4b51/html5/thumbnails/29.jpg)
Examples
![Page 30: REST & API Management with the WSO2 ESB](https://reader033.vdocuments.us/reader033/viewer/2022042518/557cf925d8b42a98158b4b51/html5/thumbnails/30.jpg)
REST APIs
● An API is similar to a web application hosted on the ESB
● Anchored at a specific URL path (context)● /test● /dictionary● /foo/bar
● Can be bound to a specific host and a port● Contains one or more resources
![Page 31: REST & API Management with the WSO2 ESB](https://reader033.vdocuments.us/reader033/viewer/2022042518/557cf925d8b42a98158b4b51/html5/thumbnails/31.jpg)
Resources
● A RESTful resource exposed over HTTP● Similar to a proxy service but focuses on REST● Can be associated with
● A set of HTTP methods– GET only, GET and POST only, All HTTP methods
● A specific content type– application/xml, application/json
● A particular class of clients (user agents)
![Page 32: REST & API Management with the WSO2 ESB](https://reader033.vdocuments.us/reader033/viewer/2022042518/557cf925d8b42a98158b4b51/html5/thumbnails/32.jpg)
Dispatching Requests to a Resource
● URL patterns● RegEx match (/test/*)● Extension match (*.jsp)● Exact match (/test/index.jsp)
● URI templates● /dictionary/{character}/{word}● /accounts/{accountId}/{operation}
![Page 33: REST & API Management with the WSO2 ESB](https://reader033.vdocuments.us/reader033/viewer/2022042518/557cf925d8b42a98158b4b51/html5/thumbnails/33.jpg)
APIs and Resources
![Page 34: REST & API Management with the WSO2 ESB](https://reader033.vdocuments.us/reader033/viewer/2022042518/557cf925d8b42a98158b4b51/html5/thumbnails/34.jpg)
Resource Examples
![Page 35: REST & API Management with the WSO2 ESB](https://reader033.vdocuments.us/reader033/viewer/2022042518/557cf925d8b42a98158b4b51/html5/thumbnails/35.jpg)
API Example
![Page 36: REST & API Management with the WSO2 ESB](https://reader033.vdocuments.us/reader033/viewer/2022042518/557cf925d8b42a98158b4b51/html5/thumbnails/36.jpg)
APIs in Action
![Page 37: REST & API Management with the WSO2 ESB](https://reader033.vdocuments.us/reader033/viewer/2022042518/557cf925d8b42a98158b4b51/html5/thumbnails/37.jpg)
API Management Goals
● Service provider objectives● Define APIs● Define security requirements and SLAs● Monitor API usage and SLAs
● Service consumer objectives● Discover and browse APIs● Sign up and obtain API keys● Consume APIs using the obtained keys● Monitor API usage and SLAs
![Page 38: REST & API Management with the WSO2 ESB](https://reader033.vdocuments.us/reader033/viewer/2022042518/557cf925d8b42a98158b4b51/html5/thumbnails/38.jpg)
Solution Architecture
![Page 39: REST & API Management with the WSO2 ESB](https://reader033.vdocuments.us/reader033/viewer/2022042518/557cf925d8b42a98158b4b51/html5/thumbnails/39.jpg)
WSO2 Product Mapping
![Page 40: REST & API Management with the WSO2 ESB](https://reader033.vdocuments.us/reader033/viewer/2022042518/557cf925d8b42a98158b4b51/html5/thumbnails/40.jpg)
Summary and Recap
● REST is a lightweight, clientserver architecture for building distributed systems
● RESTful designs are concerned with resources, states and transfer of representational state between systems
● WSO2 ESB provides excellent support for receiving, processing and intermediating REST (HTTP) calls
● The new API concept is a powerful feature which allows developers to define REST APIs in the ESB without writing any additional code
● WSO2 platform is ideally suited for developing comprehensive and flexible API management solutions based on open standards
![Page 41: REST & API Management with the WSO2 ESB](https://reader033.vdocuments.us/reader033/viewer/2022042518/557cf925d8b42a98158b4b51/html5/thumbnails/41.jpg)
Questions?
![Page 42: REST & API Management with the WSO2 ESB](https://reader033.vdocuments.us/reader033/viewer/2022042518/557cf925d8b42a98158b4b51/html5/thumbnails/42.jpg)
Selected Customers
![Page 43: REST & API Management with the WSO2 ESB](https://reader033.vdocuments.us/reader033/viewer/2022042518/557cf925d8b42a98158b4b51/html5/thumbnails/43.jpg)
WSO2 Engagement Model
● Quick Start● Development Support● Development Services● Production Support● Turnkey Solutions
● WSO2 Mobile Services Solution● WSO2 FIX Gateway Solution● WSO2 SAP Gateway Solution
![Page 44: REST & API Management with the WSO2 ESB](https://reader033.vdocuments.us/reader033/viewer/2022042518/557cf925d8b42a98158b4b51/html5/thumbnails/44.jpg)
Thank You