API Days Berlin highlights

Preview:

Citation preview

APIDAYS & APISTRATBerlin, April 23-25, 2015

tech talk @ ferret

Andrii Gakhov

Photos © CHLietzmann

MICROSERVICE ARCHITECTUREa way of designing software applications as suites of

independently deployable services.

• 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

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

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

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

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/

HYPERMEDIA APImaking a better API

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/

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/

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

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

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

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" …}

SWAGGER UI EXAMPLE

SWAGGER UI EXAMPLE

SWAGGER EDITOR EXAMPLE

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

3SCALETake control of your APIs

http://www.3scale.net/

• 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

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

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

UI EXAMPLE

THANK YOU

Recommended