Important

You are browsing the upcoming documentation for version 5.1 of OroCommerce, OroCRM and OroPlatform, which is scheduled to be released on March 2023. Read version 5.0 (the latest LTS version) of the Oro documentation to get up-to-date information.

See our Release Process documentation for more information on the currently supported and upcoming releases.

Web API Client Requirements

The only requirement for the client that will send JSON:API requests to the server is that it must specify the application/vnd.api+json media type in Accept and/or Content-Type headers.

The GET, OPTIONS and HEAD requests should have the Accept header.

The POST, PATCH and DELETE requests must have the Content-Type header and should have the Accept header.

The JSON:API media type for the Content-Type header must not contain any media type parameters.

The JSON:API media type for the Accept header must not contain any media type parameters, except quality values.

Example of a Valid GET request

GET /api/users HTTP/1.1
Accept: application/vnd.api+json

Example of Valid POST requests

POST /api/users HTTP/1.1
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json
POST /api/users HTTP/1.1
Content-Type: application/vnd.api+json

At the same time, it must ignore any media type parameters received in the Content-Type header of the response.

Example of a Response

Request

POST /api/users HTTP/1.1
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json

Response

HTTP/1.1 201 Created
Content-Type: application/vnd.api+json

{"data": [
  {
    "type": "accounts",
    "id": "1",
    "attributes": {
      "name": "Life Plan Counseling",
    },
    "relationships": {
    }
  }
]}

Requests with the non JSON:API media type value will be perceived as a plain API request, so the response data will have a plain format rather than JSON:API.

Example of Non JSON:API Media Type

Request

GET /api/users HTTP/1.1
Accept: application/json

Response

[
  {
    "id": 1,
    "name": "Life Plan Counseling",
    "contacts": [
      1
    ]
  },
]

For more information about the API client requirements, see Client Responsibilities.