Workshop: Real World REST with C# and ASP.NET
Most developers have heard of the architectural style known as REST, but even experienced developers often find it difficult to apply RESTful principles when building real-world applications. This workshop is all about building and running RESTful systems in the real world. What makes a system RESTful? Why does it matter? And how do you build one?
Over two days, you'll get a comprehensive grounding in the principles and patterns behind HTTP APIs, the architectural style known as REST, and the frameworks and formats that exist to support developers building HTTP APIs using C# and Microsoft .NET. We'll start by going right back to Roy Fielding's original thesis "Architectural Styles and the Design of Network-based Software Architectures", in which he describes the set of constraints that define this much-misunderstood architectural style. We'll explain the significance of each of these constraints, and give some examples of real-world systems that demonstrate each constraint in action.
We'll compare and contrast the four main frameworks that exist for building HTTP APIs using C# and .NET - NancyFX, ServiceStack, OpenRasta, and Microsoft's own WebAPI. We'll discuss how the recent release of .NET Core opens up new possibilities for developing and hosting your APIs, from cross-platform IDEs like Rider and Visual Studio Code, to running .NET Core on Linux and using serverless hosting environments like AWS Lambda. We'll explore the various formats that exist for representing hypermedia resources in JSON - HAL, SIREN, HYDRA, JSON-LD and Collection+JSON, and the relative merits of each. We'll go beyond 200 OK and 404 Not Found and explore how you can use the full range of HTTP verbs, headers and response codes to build expressive, responsive APIs. We'll look at ways of securing your HTTP APIs, and techniques and patterns you can use to document and test your APIs in development, and monitor them when they're running in production.
Finally, to put all this in context, we'll talk about why REST might not always be the best solution to your problem, look briefly at some of the alternative API patterns you may want to consider using, and finish up with some discussion of how RESTful services can fit into your organisation's technology strategy - and how to persuade your boss, and your team, that they're worth investing in.
You'll leave the workshop with a comprehensive understanding of building HTTP APIs in C# and .NET, your own working implementations of the patterns and techniques we've talked about, and a much clearer idea of what REST is - and why so many people are still getting wrong, nearly twenty years after it was first defined.
REST, HTTP, ASP.NET, WebAPI, NancyFX, ServiceStack, OpenRASTA. API design, hypermedia, HATEOAS, software architecture, cacheability.
Day 1: Resources and Representations
- Introducing Representation State Transfer (REST)
- Constraints and architectural styles
- Meet the Frameworks: ASP.NET WebAPI
- Working with read-only resources
- HTTP GET
- Hypermedia formats
- Content negotiation
- Resource expansion
- Layered systems, caching and scalability
- Meet the Frameworks: NancyFX
- Creating and updating resources
- Hypermedia PUT and DELETE
- Hypermedia POST and PATCH
- Beyond CRUD: modelling more complex domains
Day 2: Architecture and Infrastructure
- Meet the Frameworks: ServiceStack
- Security, monitoring and scalability
- Securing REST APIs: Authentication, API keys, OAuth2, request signatures and certificates
- Testing APIs: Hypermedia testing patterns, RunScope, NGrok
- Hosting APIs: IIS, OWIN, Kestrel, going serverless
- Scaling APIs: load balancers, API gateways, backends for frontends (BFFs)
- Meet the Frameworks: OpenRASTA
- Integration and Collaboration
- Managing APIS: versioning and documentation
- Integrating REST with message queueing and CQRS
- Alternatives to REST - and why you might want to use them
- REST on your roadmap: making the business case for hypermedia APIs
Computer Setup and Prerequisites
Attendees will need to bring a computer which can compile and run ASP.NET web applications. To run all of the examples and exercises, we recommend Microsoft Windows and a recent version of Microsoft Visual Studio (2015 or 2017) - but most of the principles and patterns will work on any platform/framework that supports HTTP and C#.