SlideShare a Scribd company logo
Build REST APIs using Swagger and IBM Integration Bus – IIB v10 | Julian Smiles
juliansmiles@ibmdeveloper.com
Build REST APIs using Swagger and IBM Integration Bus – IIB v10
Installing Swagger locally
1. Install NodeJS
a. Choose the appropriate installer from https://nodejs.org/download/
2. git clone https://github.com/swagger-api/swagger-editor.git
3. cd swagger-editor
4. npm start
Note for 3. You will find the Swagger-editor in thebelow location in Windows
C:Users{UserName}DocumentsGitHubswagger-editor
Once Swagger Editor starts locally it will open the Editor in the below location
http://localhost:8080/#/
The browserbased swagger editor is available in the internet at
http://editor.swagger.io/#/
Swagger API Specification can be found here
https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md
Create a Simple Rest API Definition in Swagger
Below is a simple REST API named Payment API. The Payment API will enable customers to view all
scheduled payments for a Customer and post payments to different accounts setup for bill pay.
The goal here is to just show how to define a REST API using Swagger as use it for development in IIB
v10. I will cover how to model REST APIs using RAML in a different post.
Below is the Payment API Swagger definition. Swagger definitions are in YAML format.
swagger: '2.0'
info:
version: '1.0.0'
title: Payment API
Build REST APIs using Swagger and IBM Integration Bus – IIB v10 | Julian Smiles
juliansmiles@ibmdeveloper.com
description: The Payment API enables customers to retrieve about all scheduled payments & post payments
termsOfService: http://wwww.ibmdeveloper.com/terms/
contact:
name: API Management Team
email: juliansmiles@ibmdeveloper.com
url: http://www.ibmdeveloper.com
license:
name: MIT
url: http://opensource.org/licenses/MIT
host: ibmdeveloper.com
basePath: /billpay
schemes:
- http
consumes:
- application/json
produces:
- application/json
paths:
/payments/{customerId}:
get:
description: Returns all Payments that are scheduled for a customer
operationId: findPayments
produces:
- application/json
- application/xml
- text/xml
- text/html
parameters:
- name: customerId
in: path
type: string
description: ID of the Customer
required: true
responses:
'200':
description: scheduled payments response
schema:
type: array
items:
$ref: '#/definitions/payments'
default:
description: unexpected error
schema:
$ref: '#/definitions/errorModel'
post:
description: Schedule/Post a new payment
operationId: postPayment
produces:
- application/json
parameters:
- name: customerId
in: path
type: string
description: ID of the Customer
required: true
Build REST APIs using Swagger and IBM Integration Bus – IIB v10 | Julian Smiles
juliansmiles@ibmdeveloper.com
- in: formData
name: paymentAmount
description: Payment Amount to be posted
required: true
type: number
format: float
- in: formData
name: paymentDate
description: Payment Date
required: true
type: string
- in: formData
name: paymentAccount
description: Account where payment is to be posted
required: true
type: string
responses:
'200':
description: payment response
schema:
$ref: '#/definitions/paymentId'
default:
description: unexpected error
schema:
$ref: '#/definitions/errorModel'
definitions:
payments:
required:
- paymentId
- paymentAccount
- paymentDate
properties:
paymentId:
$ref: '#/definitions/paymentId'
paymentAccount:
type: string
paymentDate:
type: string
tag:
type: string
paymentId:
type: integer
format: int64
errorModel:
required:
- code
- message
properties:
code:
type: integer
format: int32
message:
type: string
Build REST APIs using Swagger and IBM Integration Bus – IIB v10 | Julian Smiles
juliansmiles@ibmdeveloper.com
IIB v10 expects the definitionto be in JSON format. The Swagger editor provides theoption to save the
file in JSON format.
The Payment API has 2 methods, GET and POST
Build REST APIs using Swagger and IBM Integration Bus – IIB v10 | Julian Smiles
juliansmiles@ibmdeveloper.com
The GET method will retrieve all the payments that are scheduled for a Customer. The Customer Id is
the key that identifies a specific customer.
The POST method enables a customer to post/schedule payments to a specific bill pay account.
Build REST APIs using Swagger and IBM Integration Bus – IIB v10 | Julian Smiles
juliansmiles@ibmdeveloper.com
Below are the message models / response message formats.
The errorModel defines a generic error message format for any errors.
The response to the POST is a paymentId.
The response to the GET is the payments structure, which returns the paymentAccount, paymentDate
& paymentId
Build REST APIs using Swagger and IBM Integration Bus – IIB v10 | Julian Smiles
juliansmiles@ibmdeveloper.com
REST API Implementation using Integration Bus - IIBv10
Choose New -> Start by creating a REST API
Specify the nameof the REST API
Build REST APIs using Swagger and IBM Integration Bus – IIB v10 | Julian Smiles
juliansmiles@ibmdeveloper.com
Select the PaymentAPI.json file we downloaded earlier from the Swagger Editor
Review the API definition
Build REST APIs using Swagger and IBM Integration Bus – IIB v10 | Julian Smiles
juliansmiles@ibmdeveloper.com
Once the import is successful, the API description and sample message flows arecreated like below.
Below is the IIB generated Payment_API.msgflow. The default message domain as you cansee below is
JSON.
Build REST APIs using Swagger and IBM Integration Bus – IIB v10 | Julian Smiles
juliansmiles@ibmdeveloper.com
Below is the REST API description inside the toolkit.
Choose ‘Implement theoperation’ next to both
This will create a sub-flow for each operation i.e. one for GET and one for POST. Below is the sub-flow
for the GET operation. The name of the sub-flow reflects the operationId in the API definition.
Build REST APIs using Swagger and IBM Integration Bus – IIB v10 | Julian Smiles
juliansmiles@ibmdeveloper.com
Before we complete the entire implementation, I would like to deploy theAPI to make sure we can
invoke theAPI.
To test the API, I usePostman which is great for REST API testing. There are many other tools available
and you can use the tool of your choice. Postman is available in the Chrome App Store.
Right Click on the Payment API and deploy it to an integration server. Once it is deployed, you should
be able to see the properties like below.
It shows you the URL you need to invoke.
Let’s try to invoke the above URL using Postman
Build REST APIs using Swagger and IBM Integration Bus – IIB v10 | Julian Smiles
juliansmiles@ibmdeveloper.com
This returns a 404 as the API does not support base URL invocation. The right URL should bebaseURL
+ /billpay/{customerId}
Let’s change the URL to http://localhost:7800/billpay/payments/1212
This returns a 501 as we haven’t completed the sub-flow implementations yet.
Now that wecan invoke the API, let’s moveon to complete the message flows.
Let’s add a Compute Node to both the sub-flows and leave the ESQL code like below, deploy and test
Build REST APIs using Swagger and IBM Integration Bus – IIB v10 | Julian Smiles
juliansmiles@ibmdeveloper.com
When you try to test GET operation now, you a 200 Status code. But the responseis empty as we
haven’t implemented any code to return as valid JSON response.
Let’s make some changes to the above ESQL to return a valid response.
Build REST APIs using Swagger and IBM Integration Bus – IIB v10 | Julian Smiles
juliansmiles@ibmdeveloper.com
I have just hardcoded the values as our goal is to just build a basic API. I haven’t shown how to integrate
with a backend etc. for a comprehensive implementation as it is beyond the scope of what I am trying
to demonstrate here.
Now let’s try to invokethe URL again for GET
Build REST APIs using Swagger and IBM Integration Bus – IIB v10 | Julian Smiles
juliansmiles@ibmdeveloper.com
Now you get a valid JSON response.
You can try your POST operation similarly
Here is the representation of the JSON message tree in the debugger for the POST
I hope this information was useful to you.

More Related Content

What's hot (20)

PPTX
Cloud Native Spring - The role of Spring Cloud after Kubernetes became a main...
Orkhan Gasimov
 
PDF
Mastering Microservices with Kong (DevoxxUK 2019)
Maarten Mulders
 
PDF
Introduction to Kong API Gateway
Yohann Ciurlik
 
PDF
Kuberntes Ingress with Kong
Nebulaworks
 
PDF
Microservices & API Gateways
Kong Inc.
 
PPTX
What is an API Gateway?
LunchBadger
 
PPTX
Gatekeeper: API gateway
ChengHui Weng
 
PDF
21st Docker Switzerland Meetup - ISTIO
Niklaus Hirt
 
PDF
Itb 2021 - Bulding Quick APIs by Gavin Pickin
Gavin Pickin
 
PPTX
Going MicroServices with Net
David Revoledo
 
PPTX
Comprehensive container based service monitoring with kubernetes and istio
Fred Moyer
 
PDF
Microservice 4.0 Journey - From Spring NetFlix OSS to Istio Service Mesh and ...
Daniel Oh
 
PDF
Cloud Native Microservices with Spring Cloud
Conor Svensson
 
PPTX
The next step from Microsoft - Vnext (Srdjan Poznic)
Geekstone
 
PDF
API Gateway study
Rafael Gonzaga
 
PPTX
Connecting All Abstractions with Istio
VMware Tanzu
 
PPTX
Building a scalable microservice architecture with envoy, kubernetes and istio
SAMIR BEHARA
 
PPTX
Real time websites and mobile apps with SignalR
Roy Cornelissen
 
PPTX
Communication Amongst Microservices: Kubernetes, Istio, and Spring Cloud - An...
VMware Tanzu
 
Cloud Native Spring - The role of Spring Cloud after Kubernetes became a main...
Orkhan Gasimov
 
Mastering Microservices with Kong (DevoxxUK 2019)
Maarten Mulders
 
Introduction to Kong API Gateway
Yohann Ciurlik
 
Kuberntes Ingress with Kong
Nebulaworks
 
Microservices & API Gateways
Kong Inc.
 
What is an API Gateway?
LunchBadger
 
Gatekeeper: API gateway
ChengHui Weng
 
21st Docker Switzerland Meetup - ISTIO
Niklaus Hirt
 
Itb 2021 - Bulding Quick APIs by Gavin Pickin
Gavin Pickin
 
Going MicroServices with Net
David Revoledo
 
Comprehensive container based service monitoring with kubernetes and istio
Fred Moyer
 
Microservice 4.0 Journey - From Spring NetFlix OSS to Istio Service Mesh and ...
Daniel Oh
 
Cloud Native Microservices with Spring Cloud
Conor Svensson
 
The next step from Microsoft - Vnext (Srdjan Poznic)
Geekstone
 
API Gateway study
Rafael Gonzaga
 
Connecting All Abstractions with Istio
VMware Tanzu
 
Building a scalable microservice architecture with envoy, kubernetes and istio
SAMIR BEHARA
 
Real time websites and mobile apps with SignalR
Roy Cornelissen
 
Communication Amongst Microservices: Kubernetes, Istio, and Spring Cloud - An...
VMware Tanzu
 

Similar to Build REST API's using Swagger and IBM Integration Bus IIB v10 (20)

PDF
Hia 1691-using iib-to_support_api_economy
Andrew Coleman
 
PDF
Using IBM WebSphere Liberty and Swagger to Make your Services Accessible
Arthur De Magalhaes
 
PPTX
Introducing swagger
Amr Ali
 
PDF
Deploy and Access WebSphere Liberty and StrongLoop REST Endpoints on IBM Bluemix
Arthur De Magalhaes
 
PDF
REST APIs
Arthur De Magalhaes
 
PPTX
IRIS interface documentation training document
suganyap2503
 
PPTX
IRIS(Interaction and Integration Service) 5 2.pptx
suganyap2503
 
PDF
Eclipse Day India 2015 - Rest with Java (jax rs) and jersey
Eclipse Day India
 
PDF
Rest with java (jax rs) and jersey and swagger
Kumaraswamy M
 
PPTX
Grails with swagger
NexThoughts Technologies
 
PDF
Exposing Salesforce REST Services Using Swagger
Salesforce Developers
 
PDF
Create and Manage APIs with API Connect, Swagger and Bluemix
Dev_Events
 
PDF
The Power of IBM API Management. API connect 2016 Vegas
SaaS-Journal
 
PPTX
Salesforce Integration using REST SOAP and HTTP callouts
RAMNARAYAN R
 
PPT
HAM 1032 Combining the Power of IBM API Management and IBM Integration Bus
Karen Broughton-Mabbitt
 
ODP
Introduction to Swagger
Knoldus Inc.
 
PDF
building-rest-api-with-spring-boot-in28minutes-presentation.pdf
HarshitRaj774201
 
PPTX
Whats New in IBM Integration Bus Interconnect 2017
bthomps1979
 
PPTX
How to generate a rest application - DevFest Vienna 2016
johannes_fiala
 
ODP
Bp209
Ryan Baxter
 
Hia 1691-using iib-to_support_api_economy
Andrew Coleman
 
Using IBM WebSphere Liberty and Swagger to Make your Services Accessible
Arthur De Magalhaes
 
Introducing swagger
Amr Ali
 
Deploy and Access WebSphere Liberty and StrongLoop REST Endpoints on IBM Bluemix
Arthur De Magalhaes
 
IRIS interface documentation training document
suganyap2503
 
IRIS(Interaction and Integration Service) 5 2.pptx
suganyap2503
 
Eclipse Day India 2015 - Rest with Java (jax rs) and jersey
Eclipse Day India
 
Rest with java (jax rs) and jersey and swagger
Kumaraswamy M
 
Grails with swagger
NexThoughts Technologies
 
Exposing Salesforce REST Services Using Swagger
Salesforce Developers
 
Create and Manage APIs with API Connect, Swagger and Bluemix
Dev_Events
 
The Power of IBM API Management. API connect 2016 Vegas
SaaS-Journal
 
Salesforce Integration using REST SOAP and HTTP callouts
RAMNARAYAN R
 
HAM 1032 Combining the Power of IBM API Management and IBM Integration Bus
Karen Broughton-Mabbitt
 
Introduction to Swagger
Knoldus Inc.
 
building-rest-api-with-spring-boot-in28minutes-presentation.pdf
HarshitRaj774201
 
Whats New in IBM Integration Bus Interconnect 2017
bthomps1979
 
How to generate a rest application - DevFest Vienna 2016
johannes_fiala
 
Ad

Recently uploaded (20)

PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PDF
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
Blockchain Transactions Explained For Everyone
CIFDAQ
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PDF
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
PDF
Python basic programing language for automation
DanialHabibi2
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
Blockchain Transactions Explained For Everyone
CIFDAQ
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
Python basic programing language for automation
DanialHabibi2
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
Ad

Build REST API's using Swagger and IBM Integration Bus IIB v10

  • 1. Build REST APIs using Swagger and IBM Integration Bus – IIB v10 | Julian Smiles [email protected] Build REST APIs using Swagger and IBM Integration Bus – IIB v10 Installing Swagger locally 1. Install NodeJS a. Choose the appropriate installer from https://nodejs.org/download/ 2. git clone https://github.com/swagger-api/swagger-editor.git 3. cd swagger-editor 4. npm start Note for 3. You will find the Swagger-editor in thebelow location in Windows C:Users{UserName}DocumentsGitHubswagger-editor Once Swagger Editor starts locally it will open the Editor in the below location http://localhost:8080/#/ The browserbased swagger editor is available in the internet at http://editor.swagger.io/#/ Swagger API Specification can be found here https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md Create a Simple Rest API Definition in Swagger Below is a simple REST API named Payment API. The Payment API will enable customers to view all scheduled payments for a Customer and post payments to different accounts setup for bill pay. The goal here is to just show how to define a REST API using Swagger as use it for development in IIB v10. I will cover how to model REST APIs using RAML in a different post. Below is the Payment API Swagger definition. Swagger definitions are in YAML format. swagger: '2.0' info: version: '1.0.0' title: Payment API
  • 2. Build REST APIs using Swagger and IBM Integration Bus – IIB v10 | Julian Smiles [email protected] description: The Payment API enables customers to retrieve about all scheduled payments & post payments termsOfService: http://wwww.ibmdeveloper.com/terms/ contact: name: API Management Team email: [email protected] url: http://www.ibmdeveloper.com license: name: MIT url: http://opensource.org/licenses/MIT host: ibmdeveloper.com basePath: /billpay schemes: - http consumes: - application/json produces: - application/json paths: /payments/{customerId}: get: description: Returns all Payments that are scheduled for a customer operationId: findPayments produces: - application/json - application/xml - text/xml - text/html parameters: - name: customerId in: path type: string description: ID of the Customer required: true responses: '200': description: scheduled payments response schema: type: array items: $ref: '#/definitions/payments' default: description: unexpected error schema: $ref: '#/definitions/errorModel' post: description: Schedule/Post a new payment operationId: postPayment produces: - application/json parameters: - name: customerId in: path type: string description: ID of the Customer required: true
  • 3. Build REST APIs using Swagger and IBM Integration Bus – IIB v10 | Julian Smiles [email protected] - in: formData name: paymentAmount description: Payment Amount to be posted required: true type: number format: float - in: formData name: paymentDate description: Payment Date required: true type: string - in: formData name: paymentAccount description: Account where payment is to be posted required: true type: string responses: '200': description: payment response schema: $ref: '#/definitions/paymentId' default: description: unexpected error schema: $ref: '#/definitions/errorModel' definitions: payments: required: - paymentId - paymentAccount - paymentDate properties: paymentId: $ref: '#/definitions/paymentId' paymentAccount: type: string paymentDate: type: string tag: type: string paymentId: type: integer format: int64 errorModel: required: - code - message properties: code: type: integer format: int32 message: type: string
  • 4. Build REST APIs using Swagger and IBM Integration Bus – IIB v10 | Julian Smiles [email protected] IIB v10 expects the definitionto be in JSON format. The Swagger editor provides theoption to save the file in JSON format. The Payment API has 2 methods, GET and POST
  • 5. Build REST APIs using Swagger and IBM Integration Bus – IIB v10 | Julian Smiles [email protected] The GET method will retrieve all the payments that are scheduled for a Customer. The Customer Id is the key that identifies a specific customer. The POST method enables a customer to post/schedule payments to a specific bill pay account.
  • 6. Build REST APIs using Swagger and IBM Integration Bus – IIB v10 | Julian Smiles [email protected] Below are the message models / response message formats. The errorModel defines a generic error message format for any errors. The response to the POST is a paymentId. The response to the GET is the payments structure, which returns the paymentAccount, paymentDate & paymentId
  • 7. Build REST APIs using Swagger and IBM Integration Bus – IIB v10 | Julian Smiles [email protected] REST API Implementation using Integration Bus - IIBv10 Choose New -> Start by creating a REST API Specify the nameof the REST API
  • 8. Build REST APIs using Swagger and IBM Integration Bus – IIB v10 | Julian Smiles [email protected] Select the PaymentAPI.json file we downloaded earlier from the Swagger Editor Review the API definition
  • 9. Build REST APIs using Swagger and IBM Integration Bus – IIB v10 | Julian Smiles [email protected] Once the import is successful, the API description and sample message flows arecreated like below. Below is the IIB generated Payment_API.msgflow. The default message domain as you cansee below is JSON.
  • 10. Build REST APIs using Swagger and IBM Integration Bus – IIB v10 | Julian Smiles [email protected] Below is the REST API description inside the toolkit. Choose ‘Implement theoperation’ next to both This will create a sub-flow for each operation i.e. one for GET and one for POST. Below is the sub-flow for the GET operation. The name of the sub-flow reflects the operationId in the API definition.
  • 11. Build REST APIs using Swagger and IBM Integration Bus – IIB v10 | Julian Smiles [email protected] Before we complete the entire implementation, I would like to deploy theAPI to make sure we can invoke theAPI. To test the API, I usePostman which is great for REST API testing. There are many other tools available and you can use the tool of your choice. Postman is available in the Chrome App Store. Right Click on the Payment API and deploy it to an integration server. Once it is deployed, you should be able to see the properties like below. It shows you the URL you need to invoke. Let’s try to invoke the above URL using Postman
  • 12. Build REST APIs using Swagger and IBM Integration Bus – IIB v10 | Julian Smiles [email protected] This returns a 404 as the API does not support base URL invocation. The right URL should bebaseURL + /billpay/{customerId} Let’s change the URL to http://localhost:7800/billpay/payments/1212 This returns a 501 as we haven’t completed the sub-flow implementations yet. Now that wecan invoke the API, let’s moveon to complete the message flows. Let’s add a Compute Node to both the sub-flows and leave the ESQL code like below, deploy and test
  • 13. Build REST APIs using Swagger and IBM Integration Bus – IIB v10 | Julian Smiles [email protected] When you try to test GET operation now, you a 200 Status code. But the responseis empty as we haven’t implemented any code to return as valid JSON response. Let’s make some changes to the above ESQL to return a valid response.
  • 14. Build REST APIs using Swagger and IBM Integration Bus – IIB v10 | Julian Smiles [email protected] I have just hardcoded the values as our goal is to just build a basic API. I haven’t shown how to integrate with a backend etc. for a comprehensive implementation as it is beyond the scope of what I am trying to demonstrate here. Now let’s try to invokethe URL again for GET
  • 15. Build REST APIs using Swagger and IBM Integration Bus – IIB v10 | Julian Smiles [email protected] Now you get a valid JSON response. You can try your POST operation similarly Here is the representation of the JSON message tree in the debugger for the POST I hope this information was useful to you.