Skip to content

Myths #2

@philsturgeon

Description

@philsturgeon

REST is about CRUD

REST is no more about CRUD than any other paradigm is. RPC and Query Languages can be used for CRUD or use-case driven APIs, and researching use cases will produce an API more appropriate for the users who use cases you gathered. APIs are about balancing use cases with reusability, and not about overly normalizing your data to the point where its just a JSON version of your DB. https://medium.com/@__xuorig__/the-tension-between-data-use-case-driven-graphql-apis-8f982198653b

REST is tied to HTTP/1

Some folks who use gRPC think you need to use gRPC to get the benefits of HTTP/2?

  • REST can operate over HTTP/1.1, HTTP/2, or HTTP/3 if you like. HTTP/2 server push handles multiplexing just like gRPC, and HTTP/2 Server Push is also the basis for GraphQL/Apollo's @defer keyword

REST means huge responses

REST cannot handle real-time

  • Webhooks exist in most REST APIs to push our updates to other servers

  • GraphQL Subscriptions are generally implemented over Web Sockets, and nothing about building a REST API says you cannot use Web Sockets. Go wild.

REST does not have a type system

"Stateless" means...

REST is "stateless" in that sessions should not be sticky between servers, which helps ensure load balancers can do their job without things folks needing to log in and log out. Each message should contain the means to authenticate the user, such as HTTP Digest, OAuth credentials, Bearer token, JWT, etc.

REST is however for designing state machines. https://apisyouwonthate.com/blog/representing-state-in-rest-and-graphql

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions