25
APIDAYS & APISTRAT Berlin, April 23-25, 2015 tech talk @ ferret Andrii Gakhov

API Days Berlin highlights

Embed Size (px)

Citation preview

Page 1: API Days Berlin highlights

APIDAYS & APISTRATBerlin, April 23-25, 2015

tech talk @ ferret

Andrii Gakhov

Page 2: API Days Berlin highlights

Photos © CHLietzmann

Page 3: API Days Berlin highlights

MICROSERVICE ARCHITECTUREa way of designing software applications as suites of

independently deployable services.

Page 4: API Days Berlin highlights

• Put every element of functionality into a separate service

• Scale by distributing such services across servers, replicated if needed

• Microservice is not just a Service Oriented Architecture (SOA)

• Communication build on same principles as WWW

• Read more:http://martinfowler.com/articles/microservices.htmlby Martin Fawler and James Lewis

Page 5: API Days Berlin highlights

STRUCTURE AND MICRO DEPLOYMETfrom http://martinfowler.com/articles/microservices.html

Page 6: API Days Berlin highlights

DECENTRALIZED DATA MANAGEMENTfrom http://martinfowler.com/articles/microservices.html

Page 7: API Days Berlin highlights

TOLERATE FAILURE

• Tolerating failure in a Microservice environment is crucial.

• Small independent pieces should mean one thing failing doesn't take out the whole system.

• Lots of small pieces, loosely coupled.

• Key Term: Graceful Degradation

from talk Building Beautiful APIs and Microservices - Brendan McAdams

Page 8: API Days Berlin highlights

NANOSERVICES

• Nanoservice is an antipattern where a service is too fine-grained.

• A nanoservice is a ser vice whose overhead (communications, maintenance, and so on) outweighs its utility.

• Micro or not, services should be more useful than the overhear they incur.

from http://arnon.me/2014/03/services-microservices-nanoservices/

Page 9: API Days Berlin highlights

HYPERMEDIA APImaking a better API

Page 10: API Days Berlin highlights

WHY HYPERMEDIA API

• A problem with APIs is that they leave too much information out, so the developer spends considerable time thinking about how to work with the API.

• Hypermedia APIs solve this problem in such ways:• Provides a shared, common method for developers to interact with data.• Helps developers understand what actions they can perform on the data

using the API.

When an application makes a request using a hypermedia API, it still receives a result (some type of data) in return. However, in addition to the data, the application also receives a list of links that define what the application can do with the data now that it has it.

from http://blog.smartbear.com/apis/hypermedia-apis/working-with-hypermedia-apis/

Page 11: API Days Berlin highlights

WHAT IS HYPERMEDIA API• The basis of a Hypermedia API is the registered

hypermedia type used to provide the method of interacting with data.

• A hypermedia type is defined as a Multipurpose Internet Mail Extensions (MIME) type that contains hyper-linking semantics.

• Practical hypermedia types:• Collection+JSON (JavaScript Object Notation)• XHTML (Extensible Hypertext Markup Language)• HAL (Hypertext Application Language)

from http://blog.smartbear.com/apis/hypermedia-apis/working-with-hypermedia-apis/

Page 12: API Days Berlin highlights

HAL EXAMPLEfrom http://stateless.co/hal_specification.html

Page 13: API Days Berlin highlights

SWAGGER 2.0The World's Most Popular Framework for APIs.

Page 14: API Days Berlin highlights

SWAGGERThe goal of Swagger is to define a standard, language-agnostic interface to REST APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection.

• Swagger UI Document and present your API

• Swagger Editor Editor for designing Swagger specification using YAML

• SDK GeneratorsBuild SDK in many languages using Swagger specifications

Page 15: API Days Berlin highlights

SWAGGER SPECIFICATIONS EXAMPLE{ "get": { "description": "Returns pets by ID", "summary": "Find pets by ID", "operationId": "getPetsById", "produces": [ "application/json", "text/html" ], "responses": { "200": { "description": "pet response", "schema": { "type": "array", "items": { "$ref": "#/definitions/Pet" } } },

"default": { "description": "error payload", "schema": { "$ref": "#/definitions/ErrorModel" } … }, "parameters": [ { "name": "id", "in": "path", "description": "ID of pet to use", "required": true, "type": "array", "items": { "type": "string" }, "collectionFormat": "csv" …}

Page 16: API Days Berlin highlights

SWAGGER UI EXAMPLE

Page 17: API Days Berlin highlights

SWAGGER UI EXAMPLE

Page 18: API Days Berlin highlights

SWAGGER EDITOR EXAMPLE

Page 19: API Days Berlin highlights

COMMUNITY-DRIVEN LANGUAGE INTEGRATIONS

• Clojure• ColdFusion / CFML• Eiffel• Go• Groovy• Java

• JavaScript• Node.js• Perl• PHP• Python• Ruby• Scala

https://github.com/swagger-api/swagger-spec#additional-libraries

Page 20: API Days Berlin highlights

3SCALETake control of your APIs

http://www.3scale.net/

Page 21: API Days Berlin highlights

• Commercial tool with Freemium model• Works with any API• API user management (with rate limit etc.)• Trafic control• Payment management• Analytics• Read more:

• https://www.youtube.com/watch?v=jaUzKCvwKO4

Page 22: API Days Berlin highlights

HOW IT WORKSfrom http://www.3scale.net/how-it-works/

Page 23: API Days Berlin highlights

PRICINGfrom http://www.3scale.net/pricing/

Page 24: API Days Berlin highlights

UI EXAMPLE

Page 25: API Days Berlin highlights

THANK YOU