0

enter image description here

What this picture actually describes? I have a confusion, which is, whenever we are sending a GET request to the server via a API, are we sending it in JSON format ?Or, in HTML or any simple Text format?

On the other hand, whenever the API is sending a request (HTTP verb actually) to the server, is it using HTTP format? and the server also returns a response in HTTP format or in JSON format?

I know this question is very silly....but I am very new in API world.

1 Answers1

0

The picture is not accurate, the server sends a response and the MIME type does not matter, it can be even RDF n-triples or images depending on the type of the service and what it supports. The protocol is always HTTP, though theoretically it is possible to use a different protocol. REST has some mandatory constraints, you can read about them in the Fielding dissertation or I wrote about them here and here.

inf3rno
  • 24,976
  • 11
  • 115
  • 197