Top Banner
Joseph Fonseka & Madusanka Premaratne Building APIs from Scratch with WSO2 API Manager
12

Building APIs From Scratch with WSO2 API Manager

Aug 07, 2015

Download

Technology

WSO2
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Building APIs From Scratch with WSO2 API Manager

Joseph Fonseka & Madusanka Premaratne

Building APIs from Scratch with WSO2

API Manager

Page 2: Building APIs From Scratch with WSO2 API Manager

**

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.

Page 3: Building APIs From Scratch with WSO2 API Manager

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.

Page 4: Building APIs From Scratch with WSO2 API Manager

4

API Development Flow

Design

Test Implement

Publish

Page 5: Building APIs From Scratch with WSO2 API Manager

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/#/

Page 6: Building APIs From Scratch with WSO2 API Manager

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

Page 7: Building APIs From Scratch with WSO2 API Manager

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

Page 8: Building APIs From Scratch with WSO2 API Manager

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

Page 9: Building APIs From Scratch with WSO2 API Manager

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

Page 10: Building APIs From Scratch with WSO2 API Manager

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

Page 11: Building APIs From Scratch with WSO2 API Manager

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

Page 12: Building APIs From Scratch with WSO2 API Manager

Contact us !