SlideShare a Scribd company logo
BEAUTIFUL REST APIs
in ASP.NET Core
Nate Barbettini
@nbarbettini
recaffeinate.co
.ws
Welcome!
● Agenda
● Stormpath 101 (5 mins)
● REST APIs in ASP.NET Core (60 mins)
● Q&A (15 mins)
● Nate Barbettini
● Developer Evangelist @ Stormpath
Speed to Market & Cost Reduction
● Complete Identity solution out-of-the-box
● Security best practices and updates by default
● Clean & elegant API/SDKs
● Little to code, no maintenance
Stormpath User Management
User Data
User
Workflows Google ID
Your ApplicationsApplication SDK
Application SDK
Application SDK
ID Integrations
Facebook
Active
Directory
SAML
Overview
● What is REST?
● Why is API design important?
● HATEOAS (Hypertext As The Engine Of Application State)
● REST APIs in ASP.NET Core
REST vs. RPC
● REST: resources and collections of resources
● RPC: remote function calls
/getAccount?id=17
Bad REST API design
/getAllAccounts
/updateAccount?id=17
/createAccount
/findPostsByAccountId?account=17
/accountSearch?lname=Skywalker
/getAccount?id=17&includePosts=1
/getAccount?id=17&format=json
/countAccounts
/partialUpdateAccount?id=17
/getPostCount?id=17
/deleteUser
HATEOAS, yo!
"A REST API should be entered with no prior knowledge beyond the initial URI (bookmark)
and set of standardized media types that are appropriate for the intended audience (i.e.,
expected to be understood by any client that might use the API). From that point on, all
application state transitions must be driven by client selection of server-provided choices
that are present in the received representations or implied by the user’s manipulation of
those representations." ~ Dr. Fielding
Tl;dr The API responses themselves
should document what you are allowed to
do and where you can go.
If you can get to the root (/), you should be
able to “travel” anywhere else in the API.
Good REST design should...
● Be discoverable and self-documenting
● Represent resources and collections
● Represent actions using HTTP verbs
● KISS!
BEST PRACTICE #0
Plan API design from the beginning
Revisiting the API example
/users GET: List all users
POST: Create a user
/users/17 GET: Retrieve a single user
POST or PUT: Update user details
DELETE: Delete this user
/users/17/posts GET: Get the user’s posts
POST: Create a post
/users?lname=Skywalker
Search
/users/17?include=posts
Include linked data
BEST PRACTICE #1
Follow a design spec
A specification for REST+JSON APIs
The ION spec: https://github.com/ionwg/ion-doc
Getting a single user
GET /users/17
{
"meta": { "href": "https://example.io/users/17" },
"firstName": "Luke",
"lastName": "Skywalker"
}
Getting a list of users
GET /users
{
"meta": { "href": "https://example.io/users", "rel": ["collection"] },
"items": [{
"meta": { "href": "https://example.io/users/17" },
"firstName": "Luke",
"lastName": "Skywalker"
}, {
"meta": { "href": "https://example.io/users/18" },
"firstName": "Han",
"lastName": "Solo"
}]
}
The starting point (API root)
GET /
{
"meta": { "href": "https://example.io/" },
"users": {
"meta": {
"href": "https://example.io/users",
"rel": ["collection"],
}
}
}
● Install the .NET Core SDK - http://dot.net/core
● If you’re using Visual Studio:
○ Install the latest updates (Update 3)
○ Install the .NET Core tooling - https://go.microsoft.com/fwlink/?LinkID=827546
○ Create a new project from the ASP.NET Core (.NET Core) template
○ Pick the API subtemplate
● Or, with Visual Studio Code:
○ Use dotnet new -t web to create a new web project
○ Run dotnet restore to restore NuGet packages
● Ready to run!
Getting started with ASP.NET Core
LIVE CODING
Best practices recap
0. Plan API design from the beginning
1. Follow a design spec
2. Use async for database access
3. Write integration tests
Next steps
● Full example
https://github.com/nbarbettini/beautiful-rest-api-aspnetcore
● ION draft spec
https://github.com/ionwg/ion-doc
Thank you!
Nate Barbettini
@nbarbettini
recaffeinate.co
.ws

More Related Content

PPTX
RESTful API Design Best Practices Using ASP.NET Web API
PDF
The never-ending REST API design debate
PPTX
Building Beautiful REST APIs in ASP.NET Core
PPTX
Secure RESTful API Automation With JavaScript
PDF
Building Beautiful REST APIs in ASP.NET Core
PPTX
RESTful API Automation with JavaScript
PPTX
Best Practices for Architecting a Pragmatic Web API.
PDF
REST full API Design
RESTful API Design Best Practices Using ASP.NET Web API
The never-ending REST API design debate
Building Beautiful REST APIs in ASP.NET Core
Secure RESTful API Automation With JavaScript
Building Beautiful REST APIs in ASP.NET Core
RESTful API Automation with JavaScript
Best Practices for Architecting a Pragmatic Web API.
REST full API Design

What's hot (20)

PPSX
Rest api standards and best practices
ODP
Attacking REST API
PPTX
RESTful modules in zf2
PDF
Understanding and testing restful web services
PPTX
An Introduction To REST API
PDF
Sliding away from Roy Fielding's REST model (Filippos Vasilakis)
PPTX
RESTful API - Best Practices
PPTX
40+ tips to use Postman more efficiently
PDF
Rapid API Development with LoopBack/StrongLoop
PPTX
RESTful API Design Fundamentals
PPTX
Introduction to REST and Hypermedia
PPTX
Understanding REST APIs in 5 Simple Steps
PDF
Building an API Security Ecosystem
PDF
API for Beginners
PPTX
Working with LoopBack Models
PDF
How to Contribute to Apache Usergrid
PPTX
Getting Started with API Security Testing
PPTX
Test in Rest. API testing with the help of Rest Assured.
PDF
What is REST API? REST API Concepts and Examples | Edureka
PDF
Coding 100-session-slides
Rest api standards and best practices
Attacking REST API
RESTful modules in zf2
Understanding and testing restful web services
An Introduction To REST API
Sliding away from Roy Fielding's REST model (Filippos Vasilakis)
RESTful API - Best Practices
40+ tips to use Postman more efficiently
Rapid API Development with LoopBack/StrongLoop
RESTful API Design Fundamentals
Introduction to REST and Hypermedia
Understanding REST APIs in 5 Simple Steps
Building an API Security Ecosystem
API for Beginners
Working with LoopBack Models
How to Contribute to Apache Usergrid
Getting Started with API Security Testing
Test in Rest. API testing with the help of Rest Assured.
What is REST API? REST API Concepts and Examples | Edureka
Coding 100-session-slides
Ad

Viewers also liked (20)

PPTX
Beautiful REST+JSON APIs with Ion
PDF
Build a REST API for your Mobile Apps using Node.js
PPTX
Design Beautiful REST + JSON APIs
PPTX
Build A Killer Client For Your REST+JSON API
PPTX
Stormpath 101: Spring Boot + Spring Security
PDF
The Ultimate Guide to Mobile API Security
PPTX
JWTs for CSRF and Microservices
PPTX
Storing User Files with Express, Stormpath, and Amazon S3
PDF
Mobile Authentication for iOS Applications - Stormpath 101
PPTX
Token Authentication in ASP.NET Core
PPTX
Custom Data Search with Stormpath
PDF
JWTs in Java for CSRF and Microservices
PPTX
Spring Boot Authentication...and More!
PDF
Getting Started With Angular
PPTX
Instant Security & Scalable User Management with Spring Boot
PDF
Securing Web Applications with Token Authentication
PPTX
Multi-Tenancy with Spring Boot
PPTX
Token Authentication for Java Applications
PPTX
Browser Security 101
PPTX
REST API Security: OAuth 2.0, JWTs, and More!
Beautiful REST+JSON APIs with Ion
Build a REST API for your Mobile Apps using Node.js
Design Beautiful REST + JSON APIs
Build A Killer Client For Your REST+JSON API
Stormpath 101: Spring Boot + Spring Security
The Ultimate Guide to Mobile API Security
JWTs for CSRF and Microservices
Storing User Files with Express, Stormpath, and Amazon S3
Mobile Authentication for iOS Applications - Stormpath 101
Token Authentication in ASP.NET Core
Custom Data Search with Stormpath
JWTs in Java for CSRF and Microservices
Spring Boot Authentication...and More!
Getting Started With Angular
Instant Security & Scalable User Management with Spring Boot
Securing Web Applications with Token Authentication
Multi-Tenancy with Spring Boot
Token Authentication for Java Applications
Browser Security 101
REST API Security: OAuth 2.0, JWTs, and More!
Ad

Similar to Building Beautiful REST APIs with ASP.NET Core (20)

PPTX
RESTful APIs in .NET
PPTX
Building Software Backend (Web API)
PDF
Rest web services
PDF
Rest api best practices – comprehensive handbook
PDF
Crafting APIs
PPTX
Mastering-ASPNET-Web-API-and-RESTful-Patterns.pptx
PPTX
Rest api design
PPTX
API Design- Best Practices
PPTX
Mendix rest services
PDF
Zyncro rest api feb 2013
PPTX
Building-Robust-APIs-ASPNET-Web-API-and-RESTful-Patterns.pptx
PPTX
Http and REST APIs.
PPT
RESTful SOA - 中科院暑期讲座
PPTX
Building rest services using aspnetwebapi
PDF
usable rest apis, by Javier Ramirez from teowaki (Apidays Mediterranea)
PDF
Writing RESTful Web Services
PPTX
07 restful webservices design
PDF
Restful design principles
PDF
What is REST?
PDF
Modern REST API design principles and rules.pdf
RESTful APIs in .NET
Building Software Backend (Web API)
Rest web services
Rest api best practices – comprehensive handbook
Crafting APIs
Mastering-ASPNET-Web-API-and-RESTful-Patterns.pptx
Rest api design
API Design- Best Practices
Mendix rest services
Zyncro rest api feb 2013
Building-Robust-APIs-ASPNET-Web-API-and-RESTful-Patterns.pptx
Http and REST APIs.
RESTful SOA - 中科院暑期讲座
Building rest services using aspnetwebapi
usable rest apis, by Javier Ramirez from teowaki (Apidays Mediterranea)
Writing RESTful Web Services
07 restful webservices design
Restful design principles
What is REST?
Modern REST API design principles and rules.pdf

More from Stormpath (9)

PPTX
Secure API Services in Node with Basic Auth and OAuth2
PPTX
How to Use Stormpath in angular js
PPTX
Building Secure User Interfaces With JWTs (JSON Web Tokens)
PPTX
Rest API Security
PPTX
Elegant Rest Design Webinar
PPTX
Secure Your REST API (The Right Way)
PPTX
Build a Node.js Client for Your REST+JSON API
PPTX
So long scrum, hello kanban
PPTX
REST API Design for JAX-RS And Jersey
Secure API Services in Node with Basic Auth and OAuth2
How to Use Stormpath in angular js
Building Secure User Interfaces With JWTs (JSON Web Tokens)
Rest API Security
Elegant Rest Design Webinar
Secure Your REST API (The Right Way)
Build a Node.js Client for Your REST+JSON API
So long scrum, hello kanban
REST API Design for JAX-RS And Jersey

Recently uploaded (20)

PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Empathic Computing: Creating Shared Understanding
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
KodekX | Application Modernization Development
PDF
Machine learning based COVID-19 study performance prediction
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
Spectroscopy.pptx food analysis technology
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
madgavkar20181017ppt McKinsey Presentation.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Modernizing your data center with Dell and AMD
PPTX
Cloud computing and distributed systems.
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Reach Out and Touch Someone: Haptics and Empathic Computing
Network Security Unit 5.pdf for BCA BBA.
Empathic Computing: Creating Shared Understanding
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
20250228 LYD VKU AI Blended-Learning.pptx
KodekX | Application Modernization Development
Machine learning based COVID-19 study performance prediction
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Spectroscopy.pptx food analysis technology
Review of recent advances in non-invasive hemoglobin estimation
madgavkar20181017ppt McKinsey Presentation.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Mobile App Security Testing_ A Comprehensive Guide.pdf
Modernizing your data center with Dell and AMD
Cloud computing and distributed systems.
Chapter 3 Spatial Domain Image Processing.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
NewMind AI Weekly Chronicles - August'25 Week I
NewMind AI Monthly Chronicles - July 2025
Bridging biosciences and deep learning for revolutionary discoveries: a compr...

Building Beautiful REST APIs with ASP.NET Core

  • 1. BEAUTIFUL REST APIs in ASP.NET Core Nate Barbettini @nbarbettini recaffeinate.co .ws
  • 2. Welcome! ● Agenda ● Stormpath 101 (5 mins) ● REST APIs in ASP.NET Core (60 mins) ● Q&A (15 mins) ● Nate Barbettini ● Developer Evangelist @ Stormpath
  • 3. Speed to Market & Cost Reduction ● Complete Identity solution out-of-the-box ● Security best practices and updates by default ● Clean & elegant API/SDKs ● Little to code, no maintenance
  • 4. Stormpath User Management User Data User Workflows Google ID Your ApplicationsApplication SDK Application SDK Application SDK ID Integrations Facebook Active Directory SAML
  • 5. Overview ● What is REST? ● Why is API design important? ● HATEOAS (Hypertext As The Engine Of Application State) ● REST APIs in ASP.NET Core
  • 6. REST vs. RPC ● REST: resources and collections of resources ● RPC: remote function calls
  • 7. /getAccount?id=17 Bad REST API design /getAllAccounts /updateAccount?id=17 /createAccount /findPostsByAccountId?account=17 /accountSearch?lname=Skywalker /getAccount?id=17&includePosts=1 /getAccount?id=17&format=json /countAccounts /partialUpdateAccount?id=17 /getPostCount?id=17 /deleteUser
  • 8. HATEOAS, yo! "A REST API should be entered with no prior knowledge beyond the initial URI (bookmark) and set of standardized media types that are appropriate for the intended audience (i.e., expected to be understood by any client that might use the API). From that point on, all application state transitions must be driven by client selection of server-provided choices that are present in the received representations or implied by the user’s manipulation of those representations." ~ Dr. Fielding Tl;dr The API responses themselves should document what you are allowed to do and where you can go. If you can get to the root (/), you should be able to “travel” anywhere else in the API.
  • 9. Good REST design should... ● Be discoverable and self-documenting ● Represent resources and collections ● Represent actions using HTTP verbs ● KISS!
  • 10. BEST PRACTICE #0 Plan API design from the beginning
  • 11. Revisiting the API example /users GET: List all users POST: Create a user /users/17 GET: Retrieve a single user POST or PUT: Update user details DELETE: Delete this user /users/17/posts GET: Get the user’s posts POST: Create a post /users?lname=Skywalker Search /users/17?include=posts Include linked data
  • 12. BEST PRACTICE #1 Follow a design spec
  • 13. A specification for REST+JSON APIs The ION spec: https://github.com/ionwg/ion-doc
  • 14. Getting a single user GET /users/17 { "meta": { "href": "https://example.io/users/17" }, "firstName": "Luke", "lastName": "Skywalker" }
  • 15. Getting a list of users GET /users { "meta": { "href": "https://example.io/users", "rel": ["collection"] }, "items": [{ "meta": { "href": "https://example.io/users/17" }, "firstName": "Luke", "lastName": "Skywalker" }, { "meta": { "href": "https://example.io/users/18" }, "firstName": "Han", "lastName": "Solo" }] }
  • 16. The starting point (API root) GET / { "meta": { "href": "https://example.io/" }, "users": { "meta": { "href": "https://example.io/users", "rel": ["collection"], } } }
  • 17. ● Install the .NET Core SDK - http://dot.net/core ● If you’re using Visual Studio: ○ Install the latest updates (Update 3) ○ Install the .NET Core tooling - https://go.microsoft.com/fwlink/?LinkID=827546 ○ Create a new project from the ASP.NET Core (.NET Core) template ○ Pick the API subtemplate ● Or, with Visual Studio Code: ○ Use dotnet new -t web to create a new web project ○ Run dotnet restore to restore NuGet packages ● Ready to run! Getting started with ASP.NET Core
  • 19. Best practices recap 0. Plan API design from the beginning 1. Follow a design spec 2. Use async for database access 3. Write integration tests
  • 20. Next steps ● Full example https://github.com/nbarbettini/beautiful-rest-api-aspnetcore ● ION draft spec https://github.com/ionwg/ion-doc