Important

You are browsing the documentation for version 4.1 of OroCommerce, OroCRM and OroPlatform, which is no longer maintained. Read version 5.1 (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

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

Example of Valid POST requests

1POST /api/users HTTP/1.1
2Content-Type: application/vnd.api+json
3Accept: application/vnd.api+json
1POST /api/users HTTP/1.1
2Content-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

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

Response

 1HTTP/1.1 201 Created
 2Content-Type: application/vnd.api+json
 3
 4{"data": [
 5  {
 6    "type": "accounts",
 7    "id": "1",
 8    "attributes": {
 9      "name": "Life Plan Counseling",
10    },
11    "relationships": {
12    }
13  }
14]}

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

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

Response

1[
2  {
3    "id": 1,
4    "name": "Life Plan Counseling",
5    "contacts": [
6      1
7    ]
8  },
9]

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