There are many different HTTP APIs, REST is one of them.
REST is not only CRUD, but things are done through mainly CRUD-based operations. REST will use HTTP methods such as GET, POST, PUT, DELETE, OPTIONS and, hopefully, PATCH to provide semantic meaning for the intention of the action being taken. I can also do file uploads.
The The six constraints:
- Uniform Interface
- Stateless
- Cacheable
- Client-Server
- Layered System
- Code on Demand (optional)
HATEOAS (Hypermedia As The Engine Of Application State) is a component of the REST application architecture. REST is using hypermedia control.
RPC, compared to REST however, would not do CRUD. Most use only GET and POST, with GET being used to fetch information and POST being used for everything else. It is common to see RPC APIs using something like POST /deleteFoo, with a body of { “id”: 1 }, instead of the REST approach, which would be DELETE /foos/1.
GraphQL is incorrectly considered by some to be a “replacement” to REST
- REST and GraphQL are totally different
- GraphQL isn’t a magic bullet, nor is it “better”
- You can definitely use both at the same time
- GraphQL is dope if used for the right thing
REST is an architectural conpect, where GraphQL is query language.
- Very powerful and flexible
- Static types and introspection — GraphiQL FTW
- Many implementations in other languages, growing community
- Steeper learning curve
- No batteries included. Fair amount of assembling required
- Relay (Javascript GraphQL client) has a steep learning curve
- GraphQL has a schema and static types, Falcor does not have that. There is currently no easy way (that I know of) to tell what type of data your Falcor will return to you.
- Really straight forward, easy to learn
- Things like caching and query-merging included
- Not as powerful as GraphQL (no arguments)
- No built-in model/schema introspection
- No implementations other than JavaScript, and little visible traction