Slide 1

Slide 1 text

Mit .NET Core und HATEOAS zur perfekten REST-API? Wolfgang Wittner, Trivadis AG Manuel Meyer, Trivadis AG

Slide 2

Slide 2 text

Über uns… Wolfgang Wittner .NET/MVC/AspNetCore [email protected] Manuel Meyer C#/XAML/VS/Azure www.manuelmeyer.net [email protected]

Slide 3

Slide 3 text

1. REST 2. .Net Core 3. HATEOAS.

Slide 4

Slide 4 text

Kapitel 1: HATEO…Was?

Slide 5

Slide 5 text

REST-APIs mit .NET Core und HATEOAS?

Slide 6

Slide 6 text

REST-APIs mit .Net Core und HATEOAS REST API .Net Core HATEOAS Representational State Transfer Application Programming Interface Hypertext As The Engine Of Application State (Hypermedia)

Slide 7

Slide 7 text

The History of REST „REST started as a model how the web and web apps should work.“ Roy Fielding, 2000 https://www.youtube.com/watch?v=w5j2KwzzB-0 http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

Slide 8

Slide 8 text

The History of REST – Simple – Scalable – Reliable – Extensible. Roy Fielding, 2000 https://www.youtube.com/watch?v=w5j2KwzzB-0 http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm

Slide 9

Slide 9 text

Promotes Simplified server, Scalability, Reliability Efficiency, Scalability Visibility Independent Evolution Decoupled Implementation Simplified clients, scalability Extensibility Constraint Client Server Stateless Optional non-shared caching Uniform Interface identification of resources in request, manipulation via resources self-descriptive messages HATEOAS Layered system code on-demand (optional)

Slide 10

Slide 10 text

Zur gleichen Zeit im Office…

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

SOAP vs. REST SOAP, XML, WCF GetCustomer() UpdateCustomer() REST, HTTP GET /customer/{id} PUT /customer/{id}.

Slide 13

Slide 13 text

.NET in 2017

Slide 14

Slide 14 text

Kapitel 2: .NET Core

Slide 15

Slide 15 text

.NET vs .NET Core • Alle App-Modelle • Alle APIs • Windows • Monolith • Eingeschränkt • .NET Standard • Cross-Platform • Modular & Open Source -> Self-contained.

Slide 16

Slide 16 text

.NET Core

Slide 17

Slide 17 text

.NET Core Middleware

Slide 18

Slide 18 text

DEMO A simple .NET Core API

Slide 19

Slide 19 text

Ich seh nix! Swagger! «einherstolzieren» «grosstun» «eine grosstuerische Art an den Tag legen».

Slide 20

Slide 20 text

Swagger

Slide 21

Slide 21 text

YES, WE DO! Meet Swashbuckle! «sich draufgängerisch benehmen».

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

Swagger http://swagger.io/

Slide 24

Slide 24 text

DEMO A simple .NET Core API + Swagger

Slide 25

Slide 25 text

Kapitel 3: HATEOAS

Slide 26

Slide 26 text

https://www.martinfowler.com/articles/richardsonMaturityModel.html Richardson Maturity Model /Person GET /Person HATEOAS

Slide 27

Slide 27 text

HATEOAS «Hypermedia ist eine Erweiterung von Hypertext» «Der Rest von REST» «Der heilige Gral» «Müll». Hypermedia as the Engine of Application State

Slide 28

Slide 28 text

REST Spec Constraint Promotes Client Server Simplified server, Stateless Scalability, Reliability Optional non-shared caching Efficiency, Scalability Uniform Interface identification of resources in request, manipulation via resources self-descriptive messages HATEOAS Visibility Independen Evolution Decoupled Implementation Layered system Simplified clients, scalability code on-demand (optional) Extensibility

Slide 29

Slide 29 text

Clients Server HATEOAS / Hypermedia controller model

Slide 30

Slide 30 text

HAL Hypertext Application Language HAL = Resources & Links. content-type = application/hal+json “HAL is a simple format that gives a consistent and easy way to hyperlink between resources in your API”

Slide 31

Slide 31 text

HAL https://github.com/mikekelly/hal_specification/wiki/Libraries https://github.com/visualeyes/halcyon

Slide 32

Slide 32 text

HATEOAS GET https://api.example.com/person/117283955

Slide 33

Slide 33 text

HATEOAS GET https://api.example.com/person/117283955

Slide 34

Slide 34 text

HATEOAS

Slide 35

Slide 35 text

DEMO A simple .NET Core API + HATEOAS

Slide 36

Slide 36 text

1. REST 2. .NET Core 3. .NET Core + Swagger 4. .Net Core + HATEOAS.

Slide 37

Slide 37 text

Danke! Wolfgang Wittner .NET/MVC/AspNetCore Manuel Meyer C#/XAML/VS/Azure www.manuelmeyer.net

Slide 38

Slide 38 text

Danke!

Slide 39

Slide 39 text

Danke!

Slide 40

Slide 40 text

Danke! www.trivadis.com