from open source to open api with restlet

61
FROM OPEN SOURCE TO OPEN APIS WITH RESTLET JavaZone – September 13th, 2012

Upload: restlet

Post on 22-Jan-2015

1.343 views

Category:

Technology


10 download

DESCRIPTION

JavaZone presentation; 09/13/2012. Thierry Boileau

TRANSCRIPT

Page 1: From Open Source to Open API with Restlet

FROM OPEN SOURCE TO OPEN APIS WITH RESTLETJavaZone – September 13th, 2012

Page 2: From Open Source to Open API with Restlet

Copyright Restlet SAS – All rights reserved

SPEAKER

Thierry Boileau– PolyTech’Montpellier engineer

– 14 years of experience in IT service industry and software

– Co-founder & community manager at Restlet SAS

– Co-author of « Restlet in Action » (Manning, Sept. 2012)

Contact:– [email protected]

– Blog : blog.restlet.com

Page 3: From Open Source to Open API with Restlet

Copyright Restlet SAS – All rights reserved

ABSTRACT

1. Are Open APIs more important than Open Source? (20 mn)

2. Web APIs, ecosystem and key actors (10 mn)

3. Restlet Framework 2.1 and roadmap (20 mn)

4. APISpark, all-in-one PaaS for Web APIs (5 mn)

Page 4: From Open Source to Open API with Restlet

ARE OPEN APIS MORE IMPORTANT THAN OPEN SOURCE ?

Part 1/4

Page 5: From Open Source to Open API with Restlet

Copyright Restlet SAS – All rights reserved

NUMBER OF PUBLIC APISA STEEP INCREASE !

Source: ProgrammableWeb

Page 6: From Open Source to Open API with Restlet

Copyright Restlet SAS – All rights reserved

WHAT ABOUT PRIVATE APIS?

Source: ProgrammableWeb

Page 7: From Open Source to Open API with Restlet

Copyright Restlet SAS – All rights reserved

NUMBER OF WEB SITESLET’S COMPARE AND DREAM !

Source: NetCraft / Jacob Nielsen

Page 8: From Open Source to Open API with Restlet

Copyright Restlet SAS – All rights reserved

REST AT THE FOUNDATION OF WEB APISNOT FULLY EXPLOITED

Source: ProgrammableWeb

• REST is often thought as non-SOAP…

• But hypermedia is hardly exploited…

• AtomPub is more or less the most RESTful API today

• REST is not crucial to make your API a success

• REST as a guide for higher quality APIs, and standardization

Page 9: From Open Source to Open API with Restlet

Copyright Restlet SAS – All rights reserved

LET’S CONSUME OPEN APIS

• Enrich a web site (mashups, blogs/tweets streams,

Google Maps)

• Export/import SaaS (free data, change provider)

• SaaS integration (notify/web hooks,

automate/workflow)

• Composite APIs (combine several APIs in one

another)

Page 10: From Open Source to Open API with Restlet

Copyright Restlet SAS – All rights reserved

A WEB API EXPOSES…

• Mobile backend (connected, native, HTML5 apps)

• SaaS backend (HTML5/AJAX, developer/partner

API)

• Open data backend (multi-formats, developer API,

big data)

• Internet of Things (M2M, RFID, geo-localization)

Page 11: From Open Source to Open API with Restlet

Copyright Restlet SAS – All rights reserved

OPEN SOURCE IMPACT

• Cost reduction (licences)

• Innovation ecosystem (software)

2000 2005

Page 12: From Open Source to Open API with Restlet

Copyright Restlet SAS – All rights reserved

FROM THE OPEN SOURCE TO THE OPEN APIS

• Cost reduction (cloud computing)

• Cross-canal access (mobility, convergence)

2005 2010

Page 13: From Open Source to Open API with Restlet

Copyright Restlet SAS – All rights reserved

IMPACT OF THE OPEN APIS

• Cost reduction (composition of web APIs, open and private, time reduction)

• Innovation ecosystem (Web APIs markets, new chains of value)

2015

2020

Page 14: From Open Source to Open API with Restlet

Copyright Restlet SAS – All rights reserved

INSIDE AN API

• Standard Web API contract (ease concurrency)

• Sample contracts (Atom/AtomPub, AWS S3, CDMI, etc.)

Contract

Provider

#1

Provider

#2

API

#1

API

#2

Page 15: From Open Source to Open API with Restlet

WEB APIS ECOSYSTEM, KEY ACTORS

Part 2/4

Page 16: From Open Source to Open API with Restlet

Copyright Restlet SAS – All rights reserved

TWITTER AND THE WEB APIS

Page 17: From Open Source to Open API with Restlet

Copyright Restlet SAS – All rights reserved

TWILIO : THE WEB API IS THE PRODUCT

Page 18: From Open Source to Open API with Restlet

Copyright Restlet SAS – All rights reserved

GOOGLE MAPS IMAGE API

http://maps.googleapis.com/maps/api/staticmap?

center=Brooklyn+Bridge,New+York,NY&

zoom=14&

size=512x512&

maptype=roadmap&

markers=color:blue%7Clabel:S%7C40.702147,-

74.015794&

markers=color:green%7Clabel:G%7C40.711614,-

74.012318&

markers=color:red%7Ccolor:red%7C

label:C%7C40.718217,-73.998284&

sensor=false

• « image/png » representation of the map resource

• A REST resource can expose binary representations

Page 19: From Open Source to Open API with Restlet

Copyright Restlet SAS – All rights reserved

AMAZON WEB SERVICES AND WEB APIS

• « exotic » authentication

• Non RESTful API

• But AWS is a reference in the cloud!

Page 20: From Open Source to Open API with Restlet

Copyright Restlet SAS – All rights reserved

NEW ACTORS

• RESTful frameworks

• Doc generation

• NIO/HTTP frameworks

• Backend as a Service

• Mobile apps

• SaaS & Rich web sites

• Open Data

• Internet of Things

• Security

• Analytics

• Client SDKs

• Community management

• Catalog

• Monetization

• Promotion

• Referencing

• Oracle Jersey

• JBoss RESTEasy

• XINS, Swagger

• Enunciate

• Restlet Framework

• StackMob

• Parse.com

• Sencha.io

• FireBase

• APISpark

• Apigee

• Mashery

• 3Scale

• WebServius

• APISpark

• Programmable Web

• Mashape

• Alcatel Open API

Platform

• The easy API

• APISpark

Dedicated frameworks

Creation and hosting

ManageMarket places

Page 21: From Open Source to Open API with Restlet

RESTLET FRAMEWORK 2.1 AND ROADMAP

Part 3/4

Page 22: From Open Source to Open API with Restlet

Copyright Restlet SAS – All rights reserved

RESTLET FRAMEWORKOPEN SOURCE PROJECT CREATED IN 2005

A N D R O I D G A E G W T J A V A E EJ A V A S E

Java Language

O S G I

Framework to expose and consume

RESTful web APIs

Page 23: From Open Source to Open API with Restlet

Copyright Restlet SAS – All rights reserved

SOME REFERENCESTHOUSAND OF USERS, BIG AND SMALL

Page 24: From Open Source to Open API with Restlet

Copyright Restlet SAS – All rights reserved

ARCHITECTURE

ONE JAVA API, ONE ENGINE, 37 EXTENSIONS!

Page 25: From Open Source to Open API with Restlet

Copyright Restlet SAS – All rights reserved

MULTI-PROTOCOLSBUT, CENTERED ON HTTP!

Page 26: From Open Source to Open API with Restlet

Copyright Restlet SAS – All rights reserved

MULTI-CLOUDINCREASE THE PORTABILITY OF YOUR WEB APIS AND APPLICATIONS

Page 27: From Open Source to Open API with Restlet

Copyright Restlet SAS – All rights reserved

SUPPORT OF GOOGLE SDCSECURE ACCESS TO YOUR INTRANET FROM THE PUBLIC CLOUD

Page 28: From Open Source to Open API with Restlet

Copyright Restlet SAS – All rights reserved

MULTI-ECOSYSTEMDEEPLY ROOTED IN JAVA

Page 29: From Open Source to Open API with Restlet

Copyright Restlet SAS – All rights reserved

MULTI DISTRIBUTION

Page 30: From Open Source to Open API with Restlet

Copyright Restlet SAS – All rights reserved

REST: A PARADIGM

Page 31: From Open Source to Open API with Restlet

Copyright Restlet SAS – All rights reserved

COMPETITION 1/2SEVERAL VISIONS OF THE WEB…

HTTP toolkits

WS-*frameworks

OO web frameworks

MVC web frameworks

RESTful web framework

Wicket, Tapestry

Axis, CXF, XINS

Spring MVC, Play!

Servlet, Apache HTTP Client, Netty, etc.

Page 32: From Open Source to Open API with Restlet

Copyright Restlet SAS – All rights reserved

COMPETITION 2/2USE THE RIGHT PARADIGM !

Focus JAX-RS Focus MVCFocus RPC

Page 33: From Open Source to Open API with Restlet

RESTLET API VS JAX-RS API

Part 2-1/4

Page 34: From Open Source to Open API with Restlet

Copyright Restlet SAS – All rights reserved

RESTLET API PACKAGESCOMPLETE CORE AND STILL COMPACT

org.restlet.data

org.restlet.representation

org.restlet

org.restlet.resource

org.restlet.routing

org.restlet.security

org.restlet.service

org.restlet.util

Page 35: From Open Source to Open API with Restlet

Copyright Restlet SAS – Tous droits réservés

COMPLETE JAVA APIUSABLE AS A LIBRARY OR AS A FRAMEWORK

Page 36: From Open Source to Open API with Restlet

Copyright Restlet SAS – All rights reserved

FILTER AND ROUTINGMULTI-THREADED AND DYNAMIC

Next Restlet

Filter

B

C

A

Router

B

C

A

Route 1

Route 2

Route 3

A

B

C

Page 37: From Open Source to Open API with Restlet

Copyright Restlet SAS – All rights reserved

ANNOTATED INTERFACESUNIFY BOTH CLIENT AND SERVER CODE

public interface RootResource {

@Get("txt")

public String represent();

}

public interface AccountsResource {

@Get("txt|json|xml")

public String represent();

@Post("txt")

public String add(String account);

}

public interface AccountResource {

@Get("txt?depth={level}")

public String represent();

@Put(“form:txt")

public void store(String account);

@Delete

public void remove();

}

Page 38: From Open Source to Open API with Restlet

Copyright Restlet SAS – All rights reserved

CONVERSION SERVICEEXTENSIBLE, SCORING, REPRESENTATION BEANS

Resource

XML

HTML

JSON

StateRepresentation

bean

Form Data

RDF

Atom

Converter

service

Page 39: From Open Source to Open API with Restlet

Copyright Restlet SAS – Tous droits réservés

CLIENT AND SERVEURMULTI-LEVEL API

Page 40: From Open Source to Open API with Restlet

Copyright Restlet SAS – Tous droits réservés

RESTLET API 2.1 VS JAX-RS 2.0

Page 41: From Open Source to Open API with Restlet

Copyright Restlet SAS – All rights reserved

COMPARING JAVA APIS 1/2

Feature Restlet API 2.1 JAX-RS API 2.0

Java API style Centered on Resource and based on inheritance

Centered on POJOand annotations

Number of annotations 5 24

Supported HTTP headers 50 26

Minimum version Java SE 5.0 Java SE 6.0

Alignment on HTTP and REST Complete, almost Partial

Security Yes No

Routing (filters and routers) Yes Limited

Components and connectors Yes No

Static files Yes No

Page 42: From Open Source to Open API with Restlet

Copyright Restlet SAS – All rights reserved

COMPARING JAVA APIS 2/2

Characteristic API Restlet 2.1 API JAX-RS 2.0

Reverse proxy Yes No

Asynchronous representations Yes No

Streaming HTTP Complete Limited

Réponses provisionnelles Yes No

JCP standard No Yes

Ecosystem Open (Google, AWS, Oracle, IBM, MS, etc.)

JCP (Oracle, RedHat, OW2, etc.)

Age 7 years 5 years

Innovation Quick Slower

Page 43: From Open Source to Open API with Restlet

Copyright Restlet SAS – Tous droits réservés

DIFFERENT CODING STYLES 1/2SHOW ME THE CODE!

JAX-RS API 2.0// Get instance of Client

Client client =

ClientFactory.newClient();

// Get account balance

String bal =

client.target("http://.../atm/{cardI

d}/balance")

.pathParam("cardId", "112233")

.queryParam("pin", "9876")

.request("text/plain").get(String.cl

ass);

Restlet API 2.1// Get instance of Client

ClientResource client = new

ClientResource(""http://.../atm/{cardId}

/balance");

// Get account balance

client.setPathValue("cardId", "112233");

client.setQueryValue("pin", "9876");

client.accept(MediaType.TXT_PLAIN);

String bal = client.get(String.class);

Page 44: From Open Source to Open API with Restlet

Copyright Restlet SAS – Tous droits réservés

DIFFERENT CODING STYLES 2/2SHOW ME THE CODE!

JAX-RS API 2.0@POST

@Path(“withdrawal")

@Consumes("text/plain")

@Produces("application/json")

public Money withdraw(

@PathParam("card") String card,

@QueryParam("pin") String pin,

String amount){

return getMoney(card,

pin, amount);

}

Restlet API 2.1@Post(“txt:json”)

public Money withdraw(){

String card = getPathValue(“card”);

String pin = getQueryValue(“pin”);

String amount = getQueryValue(“amount”);

return getMoney(card, pin, amount);

}

Page 45: From Open Source to Open API with Restlet

ROADMAP

Partie 2-2/4

Page 46: From Open Source to Open API with Restlet

Copyright Restlet SAS – All rights reserved

RESTLET FRAMEWORK 2.1 (1/2)2 YEARS OF WORK !

• Incremental enhancement on the Restlet API– Syntax sugar (getQuery, getPath, etc.)– Enhanced annotations. Example: @Get("form|xml:json?level=2")– Easy logging of individual requests– Client-side ConnegService, DecoderService– Manage lack of chunk encoding on client side for the GAE platform– EMF extension (XMI/XML converter), HTML (multi-part upload)

• Enhanced security APIs– Support of AWS S3, AWS Query, Cookie and GAE schemes– Support of Google Secure Data Connector (SDC) outside GAE– New OAuth 2.0 and OpenID 2.0 extensions (draft specs)

• New internal HTTP connector– Non blocking NIO design, few threads– Zero dependency, centered HTTP/Restlet, asynchronous representation read– extensible (SIP extension)

Page 47: From Open Source to Open API with Restlet

Copyright Restlet SAS – All rights reserved

RESTLET FRAMEWORK 2.1 (2/2)RELEASED IN SEPTEMBER 2012

• « Restlet in Action » book– Paper version synchronised with version 2.1.0

• Option « Apache Public License 2.0 »– In addition to EPL 1.0, LGPL 2.1/3.0 et CDDL 1.0

– Commerciales licences available if necessary

• Migration to GitHub– SVN history with branches imported

– Import of Tigris.org issues

– Increased the number of contributions !

Page 48: From Open Source to Open API with Restlet

Copyright Restlet SAS – All rights reserved

RESTLET FRAMEWORK 2.2 (1/2)LISTEN TO THE COMMUNITY

• Migration to Google Groups– Discussion lists for users and developers still on

Tigris.org

• Migration to StackOverflow– Already used for simple questions and bugs

– Increase the quality of exchanges on the list

• Migration to Java SE 6– Java SE 5 supported since Restlet Framework 1.0 !

– Reduce the size of the code (ex: service pattern)

Page 49: From Open Source to Open API with Restlet

Copyright Restlet SAS – All rights reserved

RESTLET FRAMEWORK 2.2 (2/2)INCREMENTAL ENHANCEMENT

• Incremental enhancement– Optimize the size of Android and GWT editions

– CacheService : extensible and generic

– OSGi edition : fully dynamic management

– Injection : Guice, Spring (enhancement)

• Native JavaScript port– Same abstraction level as Java

– Client side (browser/XHR and Node.JS)

– Server side (Node.JS)

– Prototype already available!

Page 50: From Open Source to Open API with Restlet

Copyright Restlet SAS – All rights reserved

RESTLET FRAMEWORK 3.0 (1/2)FROM A FRAMEWORK TO A PLATFORM

AP

I Sp

ark

Closed source

Open source

AP

Is w

eb

sim

ple

s

Clo

ud

SophisticatedWeb APIs

Clients usages

Apps

Framework

Forge

Stu

dio

Restlet Platform

Export

Page 51: From Open Source to Open API with Restlet

Copyright Restlet SAS – All rights reserved

RESTLET FRAMEWORK 3.0 (2/2)MAIN DIRECTIONS

• Web site : new design and tutorial• Restlet Studio : IDE based on Eclipse 4.0• Restlet Apps : Search application• Internal connector

– Unify client and server runtime– Unique threads pool (via TaskService)– SPDY support (on NIO)

• Internal converter– Support of multi-formats (XML, JSON, RDF, Form, CSV, etc.)– Support of hyperlinks and HTTP metadata

• New Port : Google Dart• Support HTML 5 : Server-Sent Events, Cross-Origin policies

Page 52: From Open Source to Open API with Restlet

APISPARK, RESTLET AS A SERVICE

Partie 4/4

Page 53: From Open Source to Open API with Restlet

Copyright Restlet SAS – All rights reserved

OFFER PRESENTATION 1/2

All-in-one platform for Web APIs

• Create your Web API quickly– 5 minutes scenario based on existing API template (e.g. blog API)– Few hours scenario from scratch or by customizing an existing API template

(from the APIs catalog)– Open source foundation (Restlet Framework) , the full code can be exported

• Integrated hosting– Scalable and reactive backend (low latency, integrated management)– Permanent availability 4/24h et 7/7d (no maintenance window) and

securized (SSL confidentiality, precise management of autorisations)

• Automatic releasing– Manage several versions of your APIs at the same time at the same cost– Free to update your APIs with no impact on current users– Simple and clear lifecycle (draft, published, deprecated, archived, removed)

Page 54: From Open Source to Open API with Restlet

Copyright Restlet SAS – All rights reserved

All-in-one platform for Web APIs

• Automatic documentation– Always up-to-date– Test your API live on the Net– Easy export in PDF and HTML

• Clients kits generation– Ease the use of your API– Support of most popular platforms (iPhone/iPad, Android, Java, .NET, PHP,

Python)

• Community management– Manage the users and their signins– Private or public communities– Send publics announcements or private messages– Integration with social networks

OFFRE PRESENTATION 2/2

Page 55: From Open Source to Open API with Restlet

Copyright Restlet SAS – All rights reserved

1. Backends for connected Mobile applications– native or HTML 5

2. Backend for SaaS solution– HTML 5/AJAX, API developer/partner

3. Backend for connected objects– Perso or Pro, M2M, RFID, GPS, 3G, geoloc.

4. Backend for Open Data– Multi-formats, API developer, Big Data

USE CASES

Page 56: From Open Source to Open API with Restlet

Copyright Restlet SAS – All rights reserved

CATALOG OF APIS

Page 57: From Open Source to Open API with Restlet

Copyright Restlet SAS – All rights reserved

DESIGN YOUR WEB API

Page 58: From Open Source to Open API with Restlet

Copyright Restlet SAS – All rights reserved

ANALYTICS

Page 59: From Open Source to Open API with Restlet

Copyright Restlet SAS – All rights reserved

• Private Beta : April 2012

• Public Beta : October 2012

• Version 1.0 : Last quarter 2012

• Join-us !

http://apispark.com

ROADMAP

Page 60: From Open Source to Open API with Restlet

Copyright Restlet SAS – All rights reserved

CONCLUSIONWHY RESTLET ?

• Learning REST and HTTP is a long term investment– it takes time, as for object-oriented– first benefits easy to obtain– be pragmatic for the rest

• Web APIs give opportunities– exposition (server side) & consuming (client side)– APIs mashups, cloud workflows

• Restlet Framework– Powerful open source solution

• APISpark– Simple, all-in-one on-line solution

Page 61: From Open Source to Open API with Restlet

THANKS!