building apis from scratch with wso2 api manager
TRANSCRIPT
**
About the Presenters
๏ Joseph Fonseka Joseph joined WSO2 in September 2013. He is a Senior Tech Lead in the WSO2 API Manager team where he focuses on improving the UX of the API Manager. In addition to his product development efforts he is also a contributor to the Sahana and OpenEvsys open-source projects. He is also a FOSS advocate.
๏ Madusanka Premaratne Madusanka is an Associate Software Engineer at WSO2 where he is a part of API Manager Team. Prior to joining WSO2, Madusanka worked at CodeGen Int as a Software Engineer. He holds a first class bachelor’s degree in Information and Communication Technology from University of Jaffna, Sri Lanka.
3
Introduction
๏ This is an introductory webinar on how to develop APIs from conceptual stage to a production ready API.
๏ We will look at how WSO2 API manager and other community based tooling can help to develop an API quickly.
๏ In this session we will be focusing on RESTful APIs.
5
API Design
๏ Having a good API Design can save you lot of maintenance effort and promote API adoption.
๏ Use Swagger 2.0 to document API.http://swagger.io/
๏ Use Swagger editor to design your API.http://editor.swagger.io/#/
6
Example API
๏ Lets develop PizzaShack API which allows you to order pizza.
Resource URL HTTP Method
1 /menu GET
2 /order POST
3 /order/{orderId} GET
4 /delivery GET
7
API Implementation
๏ In this section we will discuss how to create a web service using existing swagger v2.0 file and deploy it on a web server.
๏ Required Tools๏ Java 7๏ Apache Maven 3.0.3 or greater๏ Swagger Codegen
(Go to https://github.com/swagger-api/swagger-codegen)
๏ IntelliJ IDEA
Continued
๏ Commands to run๏ mvn package ๏ java -jar <dir>/target/swagger-codegen-cli.jar generate -l jaxrs
-i <dir>/<swagger-file>.json -o <output_dir>
๏ Open the created project using an IDE๏ Implement your logic๏ Build and deploy the service๏ Implement the API by giving deployed service’s
endpoint
8
9
API Publishing
๏ In this section we will discuss about API publishing and invoking published API through WSO2 API Manager
๏ Before publishing,
๏ Set the initial/required configurations ๏ Select Gateway Environments๏ Fill the Business Information
๏ After Publishing,๏ Visit API Store๏ Subscribe to API and generate Access Token๏ Invoke the API using API Console
10
Testing with SOAP UI
๏ In this section we will discuss how to test the created APIs with SoapUI
๏ Soap UI can be used to test the created APIs๏ How to use SoapUI๏ Sample SoapUI Project
11
Creating a Client for API
๏ Use swagger-codegen to generate client stubs.
๏ Swagger-Js can be use as a javascript client to swagger enabled APIs.
https://github.com/swagger-api/swagger-js