Question about what a RESTful API is

I just wanna make sure I’m understanding correctly, so these are my own words.

A RESTful API is just a specific way of structuring an API the way the HTTP protocol is intended to be used, through crud operations.

So we can write a set of tools someone can use on the client side and the way these tools are executed will be through GET, POST, ect methods.

Am I understanding this correctly? If so, what would be an example of an api that is not restful be? Are all web development api’s restful?

An example of a non-restful api would be something like GraphQL which uses a single end point most times to send and recieve requests. There where others I heard about but never used and don’t know if they are used much anymore.

REST applications will make use of many end points to get data, send data, edit data, etc. The trade off being having to setup multipul end points

GraphQL main draw is suppose to be just working with the data you care about, but still requires some setup much like the REST application. The trade off here being one end point, but requiring some more setup and libraries to be useful.

1 Like

so having more then one end point automatically makes it restful?

Different APIs are different shades of RESTful (whatever that may mean)

There’s no universal agreement on what REST even means as far as I can tell, but in its strongest interpretation it has to obey certain rules about the endpoints and control of the resources, including stateless control and idempotency of certain operations and combinations.

If that sounds a bit confusing, it’s because it is a bit confusing, they’re a set of conventions that come from this paper: https://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm

and implemented to varying degrees by API authors, with differing opinions on what that means.

The bit that’s universally agreed on I suppose is a rough mapping from CRUD operations to HTTP requests

Personally, I wouldn’t get hung up over whether or not your API is RESTful or not, write the API that best describes interacting with your product in the most sensible way, and redesign it later if appropriate for a later version

1 Like