SlideShare a Scribd company logo
RESTful Microservices
Arthur De Magalhaes
WebSphere REST API Architect
arthurdm@ca.ibm.com
Agenda
• API Economy: Why REST?
• Best Practices
• WebSphere Liberty and REST
• Future Directions
• References
1
API Economy: Why REST?
Why do we need REST?
• So many languages, how do they expose data & functionality
consistently?
• How is communication between all the “Internet of Things”
components?
• REST abstracts languages (client and server), implementations
(libraries), and frameworks (VMs, HA, on-demand)
• But remember, not all REST apps are microservices!
3
REST API Principles
4
Monetarize existing assets!
5
Systems of Engagement
Systems of Record
Integration	bus
Team
Stats
Ticketing
Systems of Insight
Audrey
Cloud	App	Dev
Ron
Enterprise		
Developer	
Catalog		and	
Publish	APIs	
Discover	
APIs	
FANAPP
App Server Cloud
Best Practices
HTTP verbs - use them! (…with caution)
7
• Idempotent - identical requests get the same result
• Safe - can be called without modification to data.
Resource Naming
• Use an appropriate resource name rather than the backend name:
• Good: http://api.ibm.com/offering/customers/{customer_name}
• Bad: http://api.ibm.com/offering/UserContextHandler
8
Resource Chaining
• Resources in RESTful URLs can be chained together to form a
hierarchy of relationships.
– resource1/{id}/resource2/{id}
• Always use a collection followed by a member
– …/customers/123/orders/456/items/789
– Items belong to orders, orders belong to customers.
9
Resource Chaining (2)
• URLs should be Hackable ‘up the tree’
– User should be able to remove the leaf path and get an expected response
back.
– …/customers/123/orders
– Removing the end of the URL up to orders should return back all of the
orders for that customer.
• Do not use members that belong to collections without having the
collection in the path first.
– Good: /customers/123/orders/456/items/789
– Bad: /customers/123/orders/456/789
10
Attributes
• A leaf resource will return attributes about itself
GET /employees/1a2b3c
{ “name” : “Bob”, “telephone” : “905-231-3410” }
• Allow attributes to be queried and updated directly (unless read-only or
virtual, like state), but not created from parent resource
Good: GET /employees/1a2b3c/telephone
Good: PUT /employees/1a2b3c/telephone { “416-974-2418” }
Bad: POST /employees/1a2b3c { “newAttribute” : “value” }
11
Algorithmic attributes
• Transforming operations into algorithmic attributes
• Example: APIs to start and stop a server
– Bad: POST /servers { “server” : “myhost.com/sv1”, “operation” : “start”}
– Bad: POST /servers { “server” : “myhost.com/sv1”, “operation” : “stop”}
– Good: POST /host/{host_id}/servers/{server_id}/start { ..optional..}
– Good: POST /host/{host_id}/servers/{server_id}/stop { ..optional..}
• Supports a read-only / virtual attribute GET /host/{host_id}/servers/{server_id}/state
– POST instead of PUT, because algorithmic attributes are not idempotent
12
Query parameters vs header
• Use query parameters for characteristics that have an affinity to the
resource
– Ex: paging, filtering, sorting
• Use header for characteristics that have an affinity to the whole request
– Ex: security credentials, caching attribute
13
Filtering in Industry
• Filtering which fields are returned from the resource
• LinkedIn
– /people:(id,first-name,last-name,industry)
• Facebook
– /joe.smith/friends?fields=id,name,picture
• Google
– ?fields=title,media:group(media:thumbnail)
14
Searching / Querying
• Searching for specific resources
• Always apply to a collection
• Best practice is to use “name=value” pairs, matching fields
– Ex: /employees?name=Bob&city=Mooresville
• Non-RESTful examples:
15
Paging in Industry
• Paging the results of a resource
https://api.mycompany.com/v1/users?offset=50&limit=50
• Facebook
– offset, before, after, limit, next, previous
• Twitter
– cursor, count, next_cursor, total_count
• LinkedIn
– start, count
16
Versioning
• Best practice is to put the version as "vX" after context root, ie:
/myApp/v2, /myApp/v3
• Top level GET should yield what versions are available.
– ie:GET /myApp should return something like {v1 : /myApp/v1, v2:
/myApp/v2}
• No version implies v1, so specifying v1 is optional, but if expecting new
versions to come along, adding v1 from the start is considered best
practice.
17
Versioning in the industry
• Twilio
– /2010-04-01/Accounts/
• Salesforce.com
– /services/data/v20.0/objects/Account
• •Facebook
– ?v=1.0
18
Versioning should be simple
• Guidelines is to keep major (v1) or major.minor (v1.1) versioning
• Beyond that brings confusion to clients, and hinders server-side
flexibility
• Ex: Docker APIs.
– Which clusters do I have running v1.18 which need to be upgraded?
– Someone requested a v1.21 API, but I routed them to a v1.19 server…
– Client:
if (server.version = v1.23)
….
else if (server.version = v1.22)
…. 19
Security of REST APIs
• No security
– Only for trials or prototypes, never for production-level
– Need enforcement of overall transaction rate
• Basic authorization
– Simplest and oldest form of authorization
– User/Password, or Certificates
– Ex: header(“Authorization”, “Basic kjz022zxlksa”)
20
Security of REST APIs
• API keys
– Can be simply a key that identifies an user:
• GET /employees/1a2b3c?apiKey=d2lk10xl2
– Can be stronger, and also include a signature of the data which matches a
private key:
• DELETE /employees/1a2b3c?apiKey=d2lk10xl2&sig=3s00xkll213kxxl
• OAuth (OpenID Connect)
– Most modern systems support this authorization method
– Significantly increases the flexibility of your APIs (ie: log into with Google or
Facebook account)
– Can also increase security by utilizing Scopes 21
Error handling
• Industry error handling:
22
Error handling
• Best practice:
23
CORS
• Cross-origin resource sharing
• Web browsers add extra constraints for Javascript code calling to
remote servers, to avoid phishing scams and other attacks
• CORS headers:
– Origin
– Access-Control-Request-Method
– Access-Control-Request-Headers
– Access-Control-Allow-Origin
– Access-Control-Allow-Credentials
– Access-Control-Expose-Headers
– Access-Control-Max-Age
– Access-Control-Allow-Methods
– Access-Control-Allow-Headers
24
Documentation: Swagger Introduction
• Industry leading specification for defining REST APIs.
• Supports both JSON and YAML formats.
• Large open source community with various projects on GitHub:
• Client code generation (26 languages).
• Server code generation (9 languages).
• Online editor and GUI.
• Over 2000 related open-source repository, with 15000 daily downloads.
• Base specification for Open API Initiative (https://openapis.org/), under
Linux foundation.
25
Documentation: Swagger YAML Sample
26
paths:
/pet:
post:
tags:
- pet
summary: Add a new pet to the store
description: ''
operationId: addPet
consumes:
- application/json
- application/xml
produces:
- application/xml
- application/json
parameters:
- in: body
name: body
description: Pet object that needs to be added to the store
required: true
schema:
$ref: '#/definitions/Pet'
responses:
'405':
description: Invalid input
security:
- petstore_auth:
- 'write:pets'
- 'read:pets'
Documentation: Swagger Annotations
• Documents the RESTful endpoint.
• Always in-sync, since it’s together with the code.
27
Management
• Rate limiting
– Subscription to APIs; Plans
• API lifecycle
– Deprecation; N – 2 approach
• High availability
• Load balancing (API split)
– Splitting becomes more critical when using hybrid cloud environments
• Logging and auditing
28
Languages
29
• A lot of languages to choose from!
• Which is the best one??
Languages
30
• Which languages are you familiar with?
• What are your requirements today? (routing, db access)
• What are your requirements tomorrow? (on-prem vs cloud)
• Look at all the entire lifecycle of your REST APIs
• Development, Maintenance, Fire-drills, Upgrades, Access
control, etc.
• Don’t just focus on how quickly they can be made available
WebSphere Liberty and REST
API Discovery
• All applications are discoverable in a single RESTful endpoint,
/ibm/api/docs
• Query parameter allows filtering based on context root.
• Support both JSON and YAML.
• Application participation can be configured in server.xml (location, on/off).
• Available through apiDiscovery-1.0 feature.
32
Admin UI
Applications
Liberty
REST
APIProviders
API	Manager
API Discovery User Interface
• Based on the Open Source Swagger UI
• Available at /ibm/api/explorer
33
API Discovery Collective Support
• Enabling apiDiscovery-1.0 on a collective member will expose their
aggregated Swagger documentation available.
• Endpoints:
– /ibm/api/collective/docs
– /ibm/api/collective/explorer
34
Admin	UI
RepositoryREST
Controller
API	Manager
M M
M
REST	APIs	from	Members
M
API Discovery Cloud Scenario
• Can push Liberty package into Cloud Foundry
• Creates an auto-discoverable container in the cloud.
• cf push <yourappname> -p wlp/usr/servers/defaultServer
35
app
app
app
WLP
Developer
ibm.biz/wlp-api (dev / dev)
36
1.		Git	commit	java	code
2.		Travis	build	is	triggered	and	successful
3.		swagger.yaml	is	extracted	from	app,	using
IBM’s	open	source	offline	swagger	processor
4. apic’s module is invoked, passing in a committed product.yaml
from Git and generated swagger.yaml
ex: apic publish product.yaml –catalog sb
5.			APIs	are	now	available	in	APIC’s	developer	portal	
CI flow #1: auto-processing APIs during build time
CI flow #2: auto-processing APIs after deployment
37
1.		Git	commit	java	or	node	code	or	dockerfile
6.			APIs	are	now	available	in	APIC’s	developer	portal
Deploy Invoke
2.		Jenkins	builds	and	packages	apps	&	containers,	and	invokes	UCD
3.		UCD	deploys	artifacts	onto	collective
(on-prem,	cloud,	etc)
4. UCD	invokes	“curl	POST	/ibm/api/collective/docs/apiconnect,”	
sending	a	committed	product.yaml as	input
M M
MM
Future directions
Public and Branded UIs | Collective UI redesign
39
• Branded	and	public	Swagger	UI
• Inlined	collective	APIs
[
{
"title"	:	"ACME	Air",
"description"	:	“Flight	booking	service",
"version"	:	"1.0.0",
"hosts"	:	[	"myHost1:9080",	
"myHost2:9085"]
}
]
• Query	APIs	as	services
API integration with data
40
1. Many new apps use loopback to quickly expose APIs over a DB
2. Expose these system APIs via a single aggregated Swagger catalog
3. Use the app accelerator (Swagger -> jaxrs client/server) to build interaction APIs that call
various system APIs, and deploy them in Docker containers.
Data Data
system	APIs	collective
Data
Data
on-premises
interaction	APIs
private	cloud
app	developers
public	cloud
API integration with other cloud platforms
41
Amazon	API	gateway Azure	API	management	 Google	Cloud	Endpoint	+	Apigee
Liberty Collective Docker	w/	Liberty
Using subset of Swagger to register services
42
• Taking	advantage of	our	discovery	framework	‘s	dynamic behavior	to	register	and	
heartbeat	APIs as	services
• title,	description,	version,	URL,	hosts,	plus	others
Bluemix Service	Registry
Liberty Collective Docker	w/	Liberty
References
Additional Info / Resources
• IBM Middleware User Community (WAS Forum)
https://www.imwuc.org/p/fo/si/topic=1007
• Create and vote for enhancements
https://www.ibm.com/developerworks/rfe
• dwAnswers
https://developer.ibm.com/answers/
• StackOverflow
Tags: swagger, websphere-liberty
44
Demonstration
• The following blog introduces 3 videos for API Discovery
http://ibm.co/1Ytyyaa
45

More Related Content

What's hot

REST API Design & Development
REST API Design & DevelopmentREST API Design & Development
REST API Design & Development
Ashok Pundit
 
The never-ending REST API design debate
The never-ending REST API design debateThe never-ending REST API design debate
The never-ending REST API design debate
Restlet
 
Securing APIs
Securing APIsSecuring APIs
Securing APIsWSO2
 
Tale of two streaming frameworks (Karthik D - Walmart)
Tale of two streaming frameworks (Karthik D - Walmart)Tale of two streaming frameworks (Karthik D - Walmart)
Tale of two streaming frameworks (Karthik D - Walmart)
KafkaZone
 
Overview of Rest Service and ASP.NET WEB API
Overview of Rest Service and ASP.NET WEB APIOverview of Rest Service and ASP.NET WEB API
Overview of Rest Service and ASP.NET WEB API
Pankaj Bajaj
 
REST-API's for architects and managers
REST-API's for architects and managersREST-API's for architects and managers
REST-API's for architects and managers
Patrick Savalle
 
Super simple introduction to REST-APIs (2nd version)
Super simple introduction to REST-APIs (2nd version)Super simple introduction to REST-APIs (2nd version)
Super simple introduction to REST-APIs (2nd version)
Patrick Savalle
 
Scaling with swagger
Scaling with swaggerScaling with swagger
Scaling with swagger
Tony Tam
 
Aws Technical Day 2015 - Amazon API Gateway
Aws Technical Day 2015 - Amazon API GatewayAws Technical Day 2015 - Amazon API Gateway
Aws Technical Day 2015 - Amazon API Gateway
aws-marketing-il
 
Api crash
Api crashApi crash
Api crash
Hoang Nguyen
 
REST API Design
REST API DesignREST API Design
REST API Design
Devi Kiran G
 
Integrating Alfresco @ Scale (via event-driven micro-services)
Integrating Alfresco @ Scale (via event-driven micro-services)Integrating Alfresco @ Scale (via event-driven micro-services)
Integrating Alfresco @ Scale (via event-driven micro-services)
J V
 
Best Practices in Web Service Design
Best Practices in Web Service DesignBest Practices in Web Service Design
Best Practices in Web Service DesignLorna Mitchell
 
Building Beautiful REST APIs with ASP.NET Core
Building Beautiful REST APIs with ASP.NET CoreBuilding Beautiful REST APIs with ASP.NET Core
Building Beautiful REST APIs with ASP.NET Core
Stormpath
 
Restful api design
Restful api designRestful api design
Restful api design
Mizan Riqzia
 
Meetup callback
Meetup callbackMeetup callback
Meetup callback
Wayne Scarano
 

What's hot (16)

REST API Design & Development
REST API Design & DevelopmentREST API Design & Development
REST API Design & Development
 
The never-ending REST API design debate
The never-ending REST API design debateThe never-ending REST API design debate
The never-ending REST API design debate
 
Securing APIs
Securing APIsSecuring APIs
Securing APIs
 
Tale of two streaming frameworks (Karthik D - Walmart)
Tale of two streaming frameworks (Karthik D - Walmart)Tale of two streaming frameworks (Karthik D - Walmart)
Tale of two streaming frameworks (Karthik D - Walmart)
 
Overview of Rest Service and ASP.NET WEB API
Overview of Rest Service and ASP.NET WEB APIOverview of Rest Service and ASP.NET WEB API
Overview of Rest Service and ASP.NET WEB API
 
REST-API's for architects and managers
REST-API's for architects and managersREST-API's for architects and managers
REST-API's for architects and managers
 
Super simple introduction to REST-APIs (2nd version)
Super simple introduction to REST-APIs (2nd version)Super simple introduction to REST-APIs (2nd version)
Super simple introduction to REST-APIs (2nd version)
 
Scaling with swagger
Scaling with swaggerScaling with swagger
Scaling with swagger
 
Aws Technical Day 2015 - Amazon API Gateway
Aws Technical Day 2015 - Amazon API GatewayAws Technical Day 2015 - Amazon API Gateway
Aws Technical Day 2015 - Amazon API Gateway
 
Api crash
Api crashApi crash
Api crash
 
REST API Design
REST API DesignREST API Design
REST API Design
 
Integrating Alfresco @ Scale (via event-driven micro-services)
Integrating Alfresco @ Scale (via event-driven micro-services)Integrating Alfresco @ Scale (via event-driven micro-services)
Integrating Alfresco @ Scale (via event-driven micro-services)
 
Best Practices in Web Service Design
Best Practices in Web Service DesignBest Practices in Web Service Design
Best Practices in Web Service Design
 
Building Beautiful REST APIs with ASP.NET Core
Building Beautiful REST APIs with ASP.NET CoreBuilding Beautiful REST APIs with ASP.NET Core
Building Beautiful REST APIs with ASP.NET Core
 
Restful api design
Restful api designRestful api design
Restful api design
 
Meetup callback
Meetup callbackMeetup callback
Meetup callback
 

Similar to REST APIs

REST API Recommendations
REST API RecommendationsREST API Recommendations
REST API RecommendationsJeelani Shaik
 
Role of Rest vs. Web Services and EI
Role of Rest vs. Web Services and EIRole of Rest vs. Web Services and EI
Role of Rest vs. Web Services and EIWSO2
 
apidays LIVE Hong Kong 2021 - Multi-Protocol APIs at Scale in Adidas by Jesus...
apidays LIVE Hong Kong 2021 - Multi-Protocol APIs at Scale in Adidas by Jesus...apidays LIVE Hong Kong 2021 - Multi-Protocol APIs at Scale in Adidas by Jesus...
apidays LIVE Hong Kong 2021 - Multi-Protocol APIs at Scale in Adidas by Jesus...
apidays
 
Operating your Production API
Operating your Production APIOperating your Production API
Operating your Production API
Amazon Web Services
 
(ATS6-PLAT04) Query service
(ATS6-PLAT04) Query service (ATS6-PLAT04) Query service
(ATS6-PLAT04) Query service
BIOVIA
 
Build and Manage Your APIs with Amazon API Gateway
Build and Manage Your APIs with Amazon API GatewayBuild and Manage Your APIs with Amazon API Gateway
Build and Manage Your APIs with Amazon API Gateway
Amazon Web Services
 
Databasecentricapisonthecloudusingplsqlandnodejscon3153oow2016 160922021655
Databasecentricapisonthecloudusingplsqlandnodejscon3153oow2016 160922021655Databasecentricapisonthecloudusingplsqlandnodejscon3153oow2016 160922021655
Databasecentricapisonthecloudusingplsqlandnodejscon3153oow2016 160922021655
Getting value from IoT, Integration and Data Analytics
 
RESTful web APIs (build, document, manage)
RESTful web APIs (build, document, manage)RESTful web APIs (build, document, manage)
RESTful web APIs (build, document, manage)
Cisco DevNet
 
apidays LIVE Paris 2021 - Lessons from the API Stewardship Journey in Azure b...
apidays LIVE Paris 2021 - Lessons from the API Stewardship Journey in Azure b...apidays LIVE Paris 2021 - Lessons from the API Stewardship Journey in Azure b...
apidays LIVE Paris 2021 - Lessons from the API Stewardship Journey in Azure b...
apidays
 
Twelve Factor Serverless Applications
Twelve Factor Serverless ApplicationsTwelve Factor Serverless Applications
Twelve Factor Serverless Applications
Amazon Web Services
 
REST API Best Practices & Implementing in Codeigniter
REST API Best Practices & Implementing in CodeigniterREST API Best Practices & Implementing in Codeigniter
REST API Best Practices & Implementing in Codeigniter
Sachin G Kulkarni
 
Resting on your laurels will get you powned
Resting on your laurels will get you pownedResting on your laurels will get you powned
Resting on your laurels will get you powned
Dinis Cruz
 
SOA Testing
SOA TestingSOA Testing
SOA Testing
Roopesh Kohad
 
muCon 2017 - 12 Factor Serverless Applications
muCon 2017 - 12 Factor Serverless ApplicationsmuCon 2017 - 12 Factor Serverless Applications
muCon 2017 - 12 Factor Serverless Applications
Chris Munns
 
API City 2019 Presentation - Delivering Developer Tools at Scale: Microsoft A...
API City 2019 Presentation - Delivering Developer Tools at Scale: Microsoft A...API City 2019 Presentation - Delivering Developer Tools at Scale: Microsoft A...
API City 2019 Presentation - Delivering Developer Tools at Scale: Microsoft A...
Joe Levy
 
Streamlined Geek Talk
Streamlined Geek TalkStreamlined Geek Talk
Streamlined Geek Talk
Sarah Allen
 
Hia 1691-using iib-to_support_api_economy
Hia 1691-using iib-to_support_api_economyHia 1691-using iib-to_support_api_economy
Hia 1691-using iib-to_support_api_economy
Andrew Coleman
 
Restful风格ž„web服务架构
Restful风格ž„web服务架构Restful风格ž„web服务架构
Restful风格ž„web服务架构
Benjamin Tan
 

Similar to REST APIs (20)

APITalkMeetupSharable
APITalkMeetupSharableAPITalkMeetupSharable
APITalkMeetupSharable
 
REST API Recommendations
REST API RecommendationsREST API Recommendations
REST API Recommendations
 
Role of Rest vs. Web Services and EI
Role of Rest vs. Web Services and EIRole of Rest vs. Web Services and EI
Role of Rest vs. Web Services and EI
 
apidays LIVE Hong Kong 2021 - Multi-Protocol APIs at Scale in Adidas by Jesus...
apidays LIVE Hong Kong 2021 - Multi-Protocol APIs at Scale in Adidas by Jesus...apidays LIVE Hong Kong 2021 - Multi-Protocol APIs at Scale in Adidas by Jesus...
apidays LIVE Hong Kong 2021 - Multi-Protocol APIs at Scale in Adidas by Jesus...
 
Operating your Production API
Operating your Production APIOperating your Production API
Operating your Production API
 
(ATS6-PLAT04) Query service
(ATS6-PLAT04) Query service (ATS6-PLAT04) Query service
(ATS6-PLAT04) Query service
 
Build and Manage Your APIs with Amazon API Gateway
Build and Manage Your APIs with Amazon API GatewayBuild and Manage Your APIs with Amazon API Gateway
Build and Manage Your APIs with Amazon API Gateway
 
Databasecentricapisonthecloudusingplsqlandnodejscon3153oow2016 160922021655
Databasecentricapisonthecloudusingplsqlandnodejscon3153oow2016 160922021655Databasecentricapisonthecloudusingplsqlandnodejscon3153oow2016 160922021655
Databasecentricapisonthecloudusingplsqlandnodejscon3153oow2016 160922021655
 
RESTful web APIs (build, document, manage)
RESTful web APIs (build, document, manage)RESTful web APIs (build, document, manage)
RESTful web APIs (build, document, manage)
 
apidays LIVE Paris 2021 - Lessons from the API Stewardship Journey in Azure b...
apidays LIVE Paris 2021 - Lessons from the API Stewardship Journey in Azure b...apidays LIVE Paris 2021 - Lessons from the API Stewardship Journey in Azure b...
apidays LIVE Paris 2021 - Lessons from the API Stewardship Journey in Azure b...
 
Twelve Factor Serverless Applications
Twelve Factor Serverless ApplicationsTwelve Factor Serverless Applications
Twelve Factor Serverless Applications
 
REST API Best Practices & Implementing in Codeigniter
REST API Best Practices & Implementing in CodeigniterREST API Best Practices & Implementing in Codeigniter
REST API Best Practices & Implementing in Codeigniter
 
Resting on your laurels will get you powned
Resting on your laurels will get you pownedResting on your laurels will get you powned
Resting on your laurels will get you powned
 
SOA Testing
SOA TestingSOA Testing
SOA Testing
 
muCon 2017 - 12 Factor Serverless Applications
muCon 2017 - 12 Factor Serverless ApplicationsmuCon 2017 - 12 Factor Serverless Applications
muCon 2017 - 12 Factor Serverless Applications
 
API City 2019 Presentation - Delivering Developer Tools at Scale: Microsoft A...
API City 2019 Presentation - Delivering Developer Tools at Scale: Microsoft A...API City 2019 Presentation - Delivering Developer Tools at Scale: Microsoft A...
API City 2019 Presentation - Delivering Developer Tools at Scale: Microsoft A...
 
Streamlined Geek Talk
Streamlined Geek TalkStreamlined Geek Talk
Streamlined Geek Talk
 
Hia 1691-using iib-to_support_api_economy
Hia 1691-using iib-to_support_api_economyHia 1691-using iib-to_support_api_economy
Hia 1691-using iib-to_support_api_economy
 
Restful风格ž„web服务架构
Restful风格ž„web服务架构Restful风格ž„web服务架构
Restful风格ž„web服务架构
 
Rest with Spring
Rest with SpringRest with Spring
Rest with Spring
 

More from Arthur De Magalhaes

Docker 101
Docker 101Docker 101
Move existing middleware to the cloud
Move existing middleware to the cloudMove existing middleware to the cloud
Move existing middleware to the cloud
Arthur De Magalhaes
 
WebSphere 20th - Application modernization
WebSphere 20th - Application modernizationWebSphere 20th - Application modernization
WebSphere 20th - Application modernization
Arthur De Magalhaes
 
WebSphere Connect and API Discovery
WebSphere Connect and API DiscoveryWebSphere Connect and API Discovery
WebSphere Connect and API Discovery
Arthur De Magalhaes
 
Using IBM WebSphere Liberty and Swagger to Make your Services Accessible
Using IBM WebSphere Liberty and Swagger to Make your Services AccessibleUsing IBM WebSphere Liberty and Swagger to Make your Services Accessible
Using IBM WebSphere Liberty and Swagger to Make your Services Accessible
Arthur De Magalhaes
 
Exposing auto-generated Swagger 2.0 documents from Liberty!
Exposing auto-generated Swagger 2.0 documents from Liberty!Exposing auto-generated Swagger 2.0 documents from Liberty!
Exposing auto-generated Swagger 2.0 documents from Liberty!
Arthur De Magalhaes
 
Deploy and Access WebSphere Liberty and StrongLoop REST Endpoints on IBM Bluemix
Deploy and Access WebSphere Liberty and StrongLoop REST Endpoints on IBM BluemixDeploy and Access WebSphere Liberty and StrongLoop REST Endpoints on IBM Bluemix
Deploy and Access WebSphere Liberty and StrongLoop REST Endpoints on IBM Bluemix
Arthur De Magalhaes
 
Exposing APIs with Liberty and Swagger
Exposing APIs with Liberty and SwaggerExposing APIs with Liberty and Swagger
Exposing APIs with Liberty and Swagger
Arthur De Magalhaes
 
Learn How to Connect Microservices Using the Open API Initiative
Learn How to Connect Microservices Using the Open API InitiativeLearn How to Connect Microservices Using the Open API Initiative
Learn How to Connect Microservices Using the Open API Initiative
Arthur De Magalhaes
 
Design, Auto-Generate and Expose RESTful Microservices Using Open Source and ...
Design, Auto-Generate and Expose RESTful Microservices Using Open Source and ...Design, Auto-Generate and Expose RESTful Microservices Using Open Source and ...
Design, Auto-Generate and Expose RESTful Microservices Using Open Source and ...
Arthur De Magalhaes
 
Revolutionize the API Economy with IBM WebSphere Connect
Revolutionize the API Economy with IBM WebSphere ConnectRevolutionize the API Economy with IBM WebSphere Connect
Revolutionize the API Economy with IBM WebSphere Connect
Arthur De Magalhaes
 
TechConnect - API Discovery Evolution
TechConnect - API Discovery EvolutionTechConnect - API Discovery Evolution
TechConnect - API Discovery Evolution
Arthur De Magalhaes
 
CASCON 2017 - OpenAPI v3
CASCON 2017 - OpenAPI v3CASCON 2017 - OpenAPI v3
CASCON 2017 - OpenAPI v3
Arthur De Magalhaes
 
Think 2018 - MicroProfile OpenAPI
Think 2018  - MicroProfile OpenAPIThink 2018  - MicroProfile OpenAPI
Think 2018 - MicroProfile OpenAPI
Arthur De Magalhaes
 

More from Arthur De Magalhaes (14)

Docker 101
Docker 101Docker 101
Docker 101
 
Move existing middleware to the cloud
Move existing middleware to the cloudMove existing middleware to the cloud
Move existing middleware to the cloud
 
WebSphere 20th - Application modernization
WebSphere 20th - Application modernizationWebSphere 20th - Application modernization
WebSphere 20th - Application modernization
 
WebSphere Connect and API Discovery
WebSphere Connect and API DiscoveryWebSphere Connect and API Discovery
WebSphere Connect and API Discovery
 
Using IBM WebSphere Liberty and Swagger to Make your Services Accessible
Using IBM WebSphere Liberty and Swagger to Make your Services AccessibleUsing IBM WebSphere Liberty and Swagger to Make your Services Accessible
Using IBM WebSphere Liberty and Swagger to Make your Services Accessible
 
Exposing auto-generated Swagger 2.0 documents from Liberty!
Exposing auto-generated Swagger 2.0 documents from Liberty!Exposing auto-generated Swagger 2.0 documents from Liberty!
Exposing auto-generated Swagger 2.0 documents from Liberty!
 
Deploy and Access WebSphere Liberty and StrongLoop REST Endpoints on IBM Bluemix
Deploy and Access WebSphere Liberty and StrongLoop REST Endpoints on IBM BluemixDeploy and Access WebSphere Liberty and StrongLoop REST Endpoints on IBM Bluemix
Deploy and Access WebSphere Liberty and StrongLoop REST Endpoints on IBM Bluemix
 
Exposing APIs with Liberty and Swagger
Exposing APIs with Liberty and SwaggerExposing APIs with Liberty and Swagger
Exposing APIs with Liberty and Swagger
 
Learn How to Connect Microservices Using the Open API Initiative
Learn How to Connect Microservices Using the Open API InitiativeLearn How to Connect Microservices Using the Open API Initiative
Learn How to Connect Microservices Using the Open API Initiative
 
Design, Auto-Generate and Expose RESTful Microservices Using Open Source and ...
Design, Auto-Generate and Expose RESTful Microservices Using Open Source and ...Design, Auto-Generate and Expose RESTful Microservices Using Open Source and ...
Design, Auto-Generate and Expose RESTful Microservices Using Open Source and ...
 
Revolutionize the API Economy with IBM WebSphere Connect
Revolutionize the API Economy with IBM WebSphere ConnectRevolutionize the API Economy with IBM WebSphere Connect
Revolutionize the API Economy with IBM WebSphere Connect
 
TechConnect - API Discovery Evolution
TechConnect - API Discovery EvolutionTechConnect - API Discovery Evolution
TechConnect - API Discovery Evolution
 
CASCON 2017 - OpenAPI v3
CASCON 2017 - OpenAPI v3CASCON 2017 - OpenAPI v3
CASCON 2017 - OpenAPI v3
 
Think 2018 - MicroProfile OpenAPI
Think 2018  - MicroProfile OpenAPIThink 2018  - MicroProfile OpenAPI
Think 2018 - MicroProfile OpenAPI
 

Recently uploaded

Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Anthony Dahanne
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
Ortus Solutions, Corp
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Shahin Sheidaei
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
Tendenci - The Open Source AMS (Association Management Software)
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
AMB-Review
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
Graphic Design Crash Course for beginners
Graphic Design Crash Course for beginnersGraphic Design Crash Course for beginners
Graphic Design Crash Course for beginners
e20449
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
informapgpstrackings
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 

Recently uploaded (20)

Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
Graphic Design Crash Course for beginners
Graphic Design Crash Course for beginnersGraphic Design Crash Course for beginners
Graphic Design Crash Course for beginners
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 

REST APIs

  • 1. RESTful Microservices Arthur De Magalhaes WebSphere REST API Architect arthurdm@ca.ibm.com
  • 2. Agenda • API Economy: Why REST? • Best Practices • WebSphere Liberty and REST • Future Directions • References 1
  • 4. Why do we need REST? • So many languages, how do they expose data & functionality consistently? • How is communication between all the “Internet of Things” components? • REST abstracts languages (client and server), implementations (libraries), and frameworks (VMs, HA, on-demand) • But remember, not all REST apps are microservices! 3
  • 6. Monetarize existing assets! 5 Systems of Engagement Systems of Record Integration bus Team Stats Ticketing Systems of Insight Audrey Cloud App Dev Ron Enterprise Developer Catalog and Publish APIs Discover APIs FANAPP App Server Cloud
  • 8. HTTP verbs - use them! (…with caution) 7 • Idempotent - identical requests get the same result • Safe - can be called without modification to data.
  • 9. Resource Naming • Use an appropriate resource name rather than the backend name: • Good: http://api.ibm.com/offering/customers/{customer_name} • Bad: http://api.ibm.com/offering/UserContextHandler 8
  • 10. Resource Chaining • Resources in RESTful URLs can be chained together to form a hierarchy of relationships. – resource1/{id}/resource2/{id} • Always use a collection followed by a member – …/customers/123/orders/456/items/789 – Items belong to orders, orders belong to customers. 9
  • 11. Resource Chaining (2) • URLs should be Hackable ‘up the tree’ – User should be able to remove the leaf path and get an expected response back. – …/customers/123/orders – Removing the end of the URL up to orders should return back all of the orders for that customer. • Do not use members that belong to collections without having the collection in the path first. – Good: /customers/123/orders/456/items/789 – Bad: /customers/123/orders/456/789 10
  • 12. Attributes • A leaf resource will return attributes about itself GET /employees/1a2b3c { “name” : “Bob”, “telephone” : “905-231-3410” } • Allow attributes to be queried and updated directly (unless read-only or virtual, like state), but not created from parent resource Good: GET /employees/1a2b3c/telephone Good: PUT /employees/1a2b3c/telephone { “416-974-2418” } Bad: POST /employees/1a2b3c { “newAttribute” : “value” } 11
  • 13. Algorithmic attributes • Transforming operations into algorithmic attributes • Example: APIs to start and stop a server – Bad: POST /servers { “server” : “myhost.com/sv1”, “operation” : “start”} – Bad: POST /servers { “server” : “myhost.com/sv1”, “operation” : “stop”} – Good: POST /host/{host_id}/servers/{server_id}/start { ..optional..} – Good: POST /host/{host_id}/servers/{server_id}/stop { ..optional..} • Supports a read-only / virtual attribute GET /host/{host_id}/servers/{server_id}/state – POST instead of PUT, because algorithmic attributes are not idempotent 12
  • 14. Query parameters vs header • Use query parameters for characteristics that have an affinity to the resource – Ex: paging, filtering, sorting • Use header for characteristics that have an affinity to the whole request – Ex: security credentials, caching attribute 13
  • 15. Filtering in Industry • Filtering which fields are returned from the resource • LinkedIn – /people:(id,first-name,last-name,industry) • Facebook – /joe.smith/friends?fields=id,name,picture • Google – ?fields=title,media:group(media:thumbnail) 14
  • 16. Searching / Querying • Searching for specific resources • Always apply to a collection • Best practice is to use “name=value” pairs, matching fields – Ex: /employees?name=Bob&city=Mooresville • Non-RESTful examples: 15
  • 17. Paging in Industry • Paging the results of a resource https://api.mycompany.com/v1/users?offset=50&limit=50 • Facebook – offset, before, after, limit, next, previous • Twitter – cursor, count, next_cursor, total_count • LinkedIn – start, count 16
  • 18. Versioning • Best practice is to put the version as "vX" after context root, ie: /myApp/v2, /myApp/v3 • Top level GET should yield what versions are available. – ie:GET /myApp should return something like {v1 : /myApp/v1, v2: /myApp/v2} • No version implies v1, so specifying v1 is optional, but if expecting new versions to come along, adding v1 from the start is considered best practice. 17
  • 19. Versioning in the industry • Twilio – /2010-04-01/Accounts/ • Salesforce.com – /services/data/v20.0/objects/Account • •Facebook – ?v=1.0 18
  • 20. Versioning should be simple • Guidelines is to keep major (v1) or major.minor (v1.1) versioning • Beyond that brings confusion to clients, and hinders server-side flexibility • Ex: Docker APIs. – Which clusters do I have running v1.18 which need to be upgraded? – Someone requested a v1.21 API, but I routed them to a v1.19 server… – Client: if (server.version = v1.23) …. else if (server.version = v1.22) …. 19
  • 21. Security of REST APIs • No security – Only for trials or prototypes, never for production-level – Need enforcement of overall transaction rate • Basic authorization – Simplest and oldest form of authorization – User/Password, or Certificates – Ex: header(“Authorization”, “Basic kjz022zxlksa”) 20
  • 22. Security of REST APIs • API keys – Can be simply a key that identifies an user: • GET /employees/1a2b3c?apiKey=d2lk10xl2 – Can be stronger, and also include a signature of the data which matches a private key: • DELETE /employees/1a2b3c?apiKey=d2lk10xl2&sig=3s00xkll213kxxl • OAuth (OpenID Connect) – Most modern systems support this authorization method – Significantly increases the flexibility of your APIs (ie: log into with Google or Facebook account) – Can also increase security by utilizing Scopes 21
  • 23. Error handling • Industry error handling: 22
  • 24. Error handling • Best practice: 23
  • 25. CORS • Cross-origin resource sharing • Web browsers add extra constraints for Javascript code calling to remote servers, to avoid phishing scams and other attacks • CORS headers: – Origin – Access-Control-Request-Method – Access-Control-Request-Headers – Access-Control-Allow-Origin – Access-Control-Allow-Credentials – Access-Control-Expose-Headers – Access-Control-Max-Age – Access-Control-Allow-Methods – Access-Control-Allow-Headers 24
  • 26. Documentation: Swagger Introduction • Industry leading specification for defining REST APIs. • Supports both JSON and YAML formats. • Large open source community with various projects on GitHub: • Client code generation (26 languages). • Server code generation (9 languages). • Online editor and GUI. • Over 2000 related open-source repository, with 15000 daily downloads. • Base specification for Open API Initiative (https://openapis.org/), under Linux foundation. 25
  • 27. Documentation: Swagger YAML Sample 26 paths: /pet: post: tags: - pet summary: Add a new pet to the store description: '' operationId: addPet consumes: - application/json - application/xml produces: - application/xml - application/json parameters: - in: body name: body description: Pet object that needs to be added to the store required: true schema: $ref: '#/definitions/Pet' responses: '405': description: Invalid input security: - petstore_auth: - 'write:pets' - 'read:pets'
  • 28. Documentation: Swagger Annotations • Documents the RESTful endpoint. • Always in-sync, since it’s together with the code. 27
  • 29. Management • Rate limiting – Subscription to APIs; Plans • API lifecycle – Deprecation; N – 2 approach • High availability • Load balancing (API split) – Splitting becomes more critical when using hybrid cloud environments • Logging and auditing 28
  • 30. Languages 29 • A lot of languages to choose from! • Which is the best one??
  • 31. Languages 30 • Which languages are you familiar with? • What are your requirements today? (routing, db access) • What are your requirements tomorrow? (on-prem vs cloud) • Look at all the entire lifecycle of your REST APIs • Development, Maintenance, Fire-drills, Upgrades, Access control, etc. • Don’t just focus on how quickly they can be made available
  • 33. API Discovery • All applications are discoverable in a single RESTful endpoint, /ibm/api/docs • Query parameter allows filtering based on context root. • Support both JSON and YAML. • Application participation can be configured in server.xml (location, on/off). • Available through apiDiscovery-1.0 feature. 32 Admin UI Applications Liberty REST APIProviders API Manager
  • 34. API Discovery User Interface • Based on the Open Source Swagger UI • Available at /ibm/api/explorer 33
  • 35. API Discovery Collective Support • Enabling apiDiscovery-1.0 on a collective member will expose their aggregated Swagger documentation available. • Endpoints: – /ibm/api/collective/docs – /ibm/api/collective/explorer 34 Admin UI RepositoryREST Controller API Manager M M M REST APIs from Members M
  • 36. API Discovery Cloud Scenario • Can push Liberty package into Cloud Foundry • Creates an auto-discoverable container in the cloud. • cf push <yourappname> -p wlp/usr/servers/defaultServer 35 app app app WLP Developer ibm.biz/wlp-api (dev / dev)
  • 37. 36 1. Git commit java code 2. Travis build is triggered and successful 3. swagger.yaml is extracted from app, using IBM’s open source offline swagger processor 4. apic’s module is invoked, passing in a committed product.yaml from Git and generated swagger.yaml ex: apic publish product.yaml –catalog sb 5. APIs are now available in APIC’s developer portal CI flow #1: auto-processing APIs during build time
  • 38. CI flow #2: auto-processing APIs after deployment 37 1. Git commit java or node code or dockerfile 6. APIs are now available in APIC’s developer portal Deploy Invoke 2. Jenkins builds and packages apps & containers, and invokes UCD 3. UCD deploys artifacts onto collective (on-prem, cloud, etc) 4. UCD invokes “curl POST /ibm/api/collective/docs/apiconnect,” sending a committed product.yaml as input M M MM
  • 40. Public and Branded UIs | Collective UI redesign 39 • Branded and public Swagger UI • Inlined collective APIs [ { "title" : "ACME Air", "description" : “Flight booking service", "version" : "1.0.0", "hosts" : [ "myHost1:9080", "myHost2:9085"] } ] • Query APIs as services
  • 41. API integration with data 40 1. Many new apps use loopback to quickly expose APIs over a DB 2. Expose these system APIs via a single aggregated Swagger catalog 3. Use the app accelerator (Swagger -> jaxrs client/server) to build interaction APIs that call various system APIs, and deploy them in Docker containers. Data Data system APIs collective Data Data on-premises interaction APIs private cloud app developers public cloud
  • 42. API integration with other cloud platforms 41 Amazon API gateway Azure API management Google Cloud Endpoint + Apigee Liberty Collective Docker w/ Liberty
  • 43. Using subset of Swagger to register services 42 • Taking advantage of our discovery framework ‘s dynamic behavior to register and heartbeat APIs as services • title, description, version, URL, hosts, plus others Bluemix Service Registry Liberty Collective Docker w/ Liberty
  • 45. Additional Info / Resources • IBM Middleware User Community (WAS Forum) https://www.imwuc.org/p/fo/si/topic=1007 • Create and vote for enhancements https://www.ibm.com/developerworks/rfe • dwAnswers https://developer.ibm.com/answers/ • StackOverflow Tags: swagger, websphere-liberty 44
  • 46. Demonstration • The following blog introduces 3 videos for API Discovery http://ibm.co/1Ytyyaa 45