But while you’ll almost always be doing CRUD actions, there’s no intrinsic reason you need to use REST to get there. An RPC way to do CRUD actions would be to have four endpoints: ‘/createnote’, ‘/getnote’, ‘/updatenote’, ‘/deletenote’. Also totally valid, but perhaps less intuitive.
Hi Igor,
Scott Domes
641

OK. So you’re saying that REST is the way to do CRUD operations using single endpoint? What about https://en.wikipedia.org/wiki/HATEOAS — very important principle of the REST architecture?

For me an API is not the way to interact with database. There are other ways to interact with database. Web API is a way to interact with a service. I would say even more: a CRUD looks like a way to interact with a key-value storage, not a classic database providing some way to control which data is selected and how it is ordered.

That’s what I can’t understand: if an endpoint is a list, and that list can be sorted server-side, is it a CRUD way or not? How that can be distinguished from RPC if there is a way to send to the server some parameters changing the resource? Example: an endpoint returns a list of top ten users, sorted by their nicknames alphabetically. If there is a param reversing the order — is that API still a CRUD API or it became RPC already?

But the main my question is how you provide the links to possible resources and actions in the responses to requests to your API endpoints? I didn’t find it the article.

Like what you read? Give Igor Data a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.