liveBook · Manning

Resource manipulation through representations

As explained in Building Web APIs with ASP.NET Core

Manipulation through representations is the REST uniform-interface principle that a representation contains enough information to modify, delete, or create related resources.

Resource manipulation through representations is a REST uniform-interface principle: clients use a resource URI, its representation, and the appropriate HTTP method to read, modify, delete, or create related resources without extra implementation-specific information. section 1.1.4 section 3.1.6

A representation supports manipulation when it:

  • Identifies the target resource through a unique URI. section 1.1.4
  • Uses standard HTTP methods such as GET and DELETE at that URI, with other methods applying corresponding operations. section 1.1.4
  • Includes descriptive links that tell clients how to alter the resource or request related resources, when permitted. section 3.1.6

Board-game resource

A client can read board game 11 with GET https://mybglist.com/api/games/11 and delete it with DELETE at the same URI. A collection representation can also expose links such as self with its href, relation, and HTTP type. section 1.1.4 section 3.1.6

{
   "data": [
       {
           "id": 1,
           "name": "Axis & Allies",
           "year": 1981
       },
       {
           "id": 2,
           "name": "Citadels",
           "year": 2000
       },
       {
           "id": 3,
           "name": "Terraforming Mars",
           "year": 2016
       }
   ],
   "links": [
       {
           "href": "https://localhost:40443/BoardGames",
           "rel": "self",
           "type": "GET"
       }
   ]
}

Inspect the JSON envelope showing board-game data alongside a self link with its URI, relation, and HTTP method. section 3.1.6

How Building Web APIs with ASP.NET Core covers it

How deep it goes
Explains the principle with URI, HTTP-method, permission, and JSON-link examples, without detailing server-side mutation handlers.
Examples
Uses a board-game URI, GET and DELETE requests, and a JSON collection containing data plus a self link.
What you can do after
Apply via HTTP methods and descriptive representation links when designing client-server operations for a RESTful web API.
How it connects
Connects resource manipulation with REST, uniform interface, resource identification, self-descriptive messages, and HATEOAS.

This explainer was generated by Manning's knowledge graph from the text of Building Web APIs with ASP.NET Core. The section links point to the parts of the book it draws on.