An example of sending JSON to the REST API endpoint that implements JSON:API. In this JSON API example, the Content-Type: application/vnd.api+json request header specifies the media type of the request body as JSON. The server informs the client that it has returned JSON with a Content-Type: application/json response header. The Python code was automatically generated from the JSON API Example.
JSON API is a text-based data exchange format designed to work with HTTP. JSON API is described at JSONAPI.org and differs from the REST API. The JSON API defines how clients should request data from the server and how the server should respond to requests. The JSON API provides improved caching functionality and optimizes HTTP requests by eliminating unnecessary requests to the server.
How to Send a JSON API Request?
JSON API clients and servers should send requests and responses with the following HTTP header:
JSON API clients must also send an Accept header to tell the server that they can accept JSON API requests.
Advantages of JSON API
The main advantage of the JSON API is that it reduces both the number of requests and the amount of data transferred between clients and servers.