Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is there a specification for RESTful APIs [closed]

I have seen many ways/guides/tutrials implementing RESTful web services, I have even implemented many myself. I understand the basic principles that a restful service should follow because I have inferred them from many different sources, articles, other web services, etc.

Now I am studying the protocols and standards that govern the web in more detail , reading specs, RFCs, etc

Is there a document, RFC or specification that is widely accepted that explains what a RESTful web service should be compliant with?.

like image 282
Joaquin Brandan Avatar asked Mar 23 '18 00:03

Joaquin Brandan


People also ask

What is a RESTful API specification?

A RESTful API is an architectural style for an application program interface (API) that uses HTTP requests to access and use data. That data can be used to GET, PUT, POST and DELETE data types, which refers to the reading, updating, creating and deleting of operations concerning resources.

Is there a standard for REST API?

OpenAPI is a standard to describe REST APIs and it allows you to declare your API security method, endpoints, request/response data, and HTTP status messages. Together, these define your API in a single document. These are useful during the design phase, but can also be useful throughout the API lifecycle.

Which is the most commonly accepted REST API specification standard?

OpenAPI Specification. Of the many API documentation and specification formats, OpenAPI Specification (previously Swagger) is certainly one of the most popular. To call Swagger a “documentation” or “specification” format, however, is somewhat misleading.

Is REST API an open standard?

REST APIs vs.The most common open API architectures fall into two categories: REST APIs and SOAP APIs. SOAP and REST offer different methods to invoke a web service. SOAP-based APIs typically use XML as a data exchange format, while RESTful APIs typically use JSON back and forth.


1 Answers

In 2008, Leonard Richardson introduced a maturity model for web services, based on the three primary technologies in the web stack:

  • URI
  • HTTP
  • Hypermedia

URI

URI's are defined by RFC 3986.

HTTP

HTTP in 2022 is defined by

  • RFC 9110 -- HTTP Semantics
  • RFC 9111 -- HTTP Caching
  • RFC 9112 -- HTTP/1.1
  • RFC 9113 -- HTTP/2
  • RFC 9114 -- HTTP/3

HTTP in 2018 was defined by

  • RFC 7230 -- Message Syntax and Routing
  • RFC 7231 -- Semantics and Content
  • RFC 7232 -- Conditional Requests
  • RFC 7233 -- Range Requests
  • RFC 7234 -- Caching
  • RFC 7235 -- Authentication

Hypermedia

This is the hard one. The ubiquitous hypermedia media type is still HTML, you could start with HTML 5.2.

A number of API try to use JSON, but JSON doesn't define links; so if you want to go that route, you need to find a JSON variant which defines links.

Kevin Sookocheff wrote a nice overview of some options

  • JSON-LD
  • HAL
  • Collection+JSON
  • SIREN
like image 196
VoiceOfUnreason Avatar answered Nov 15 '22 20:11

VoiceOfUnreason