Requests, resources, responses

REST APIs in ASP.NET Core

Follow REST resource design, HTTP method semantics, status codes, and secure API access with interactive request examples.

Explore the concepts

Pick a concept. Read the code. Make the call.

Each example contrasts a common design problem with one possible improvement. The best design still depends on context.

Name the thing; let the HTTP method express the action.

Resources and routes

1Client request
2Resource route
3API response

What to notice

Verb-heavy routes make the URL describe an RPC action instead of a resource.

C# / HTTP / SQL sample

A design to question

POST /getUserById?id=42
POST /deleteUser?id=42

Right or wrong: is this version a good fit?

Quick knowledge check

Put your interview hat on

1 / 4

Which route is the most resource-oriented for retrieving user 42?

Based on our REST API interview guide. Examples are simplified for learning; adapt patterns to the requirements of your application.