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.
HTTP Header Specifics¶
As mentioned in the Client Requirements and Authentication sections, to perform an JSON:API request successfully, it is important to provide the correct Accept, Content-Type and Authentication parameters, e.g.,:
1GET /api/users HTTP/1.1
2Accept: application/vnd.api+json
3Authorization: Bearer <access token>
Also, by providing additional requests header parameters, it is possible to retrieve additional information, such as the total number of records per certain resource for the GET and DELETE methods or a total number of affected records for the DELETE method. The X-Include request header can be used for such purposes.
The following table describes all existing keys for the X-Include header.
HTTP Method |
X-Include key |
Response Header |
Description |
---|---|---|---|
any |
noHateoas |
Removes all HATEOAS related links from the response. |
|
GET |
totalCount |
X-Include-Total-Count |
Returns the total number of entities. |
DELETE |
totalCount |
X-Include-Total-Count |
Returns the total number of entities. |
DELETE |
deletedCount |
X-Include-Deleted-Count |
Returns the number of deleted entities. |
Header Examples
Example 1. Total Number of Existing Records
Retrieve the total count of resource records.
Request header
1GET /api/users HTTP/1.1
2Accept: application/vnd.api+json
3X-Include: totalCount
Response
1HTTP/1.1 200 OK
2X-Include-Total-Count: 49
3Content-Type: application/vnd.api+json
4Date: Fri, 23 Sep 2016 12:27:05 GMT
5Content-Length: 585
6Keep-Alive: timeout=5, max=100
7Connection: Keep-Alive
Example 2. Total Number of Deleted Records
Retrieve the total number of deleted records of the resource
Request header
1DELETE /api/users HTTP/1.1
2Accept: application/vnd.api+json
3X-Include: deletedCount
Example 3. Conditions for the Delete Operation
Request query string contains a filter that specifies conditions for deletion operation. Filters are described in more detail in the Filters section.
Request header
1DELETE /api/users?filter[id]=21,22 HTTP/1.1
2Accept: application/vnd.api+json
Response
1HTTP/1.1 204 No Content
2X-Include-Deleted-Count: 2
3Date: Fri, 23 Sep 2016 12:38:47 GMT
4Content-Length: 0
5Keep-Alive: timeout=5, max=100
6Connection: Keep-Alive
The following request headers are available for the storefront API.
HTTP Method |
Request Header |
Description |
---|---|---|
any |
X-Localization-ID |
By default, all locale sensitive data are received and returned in the locale
selected for the current website. This header can be used to specify another
locale. The list of available localization IDs can be received via the
|
any |
X-Currency |
By default, all currency-related data are received and returned in the currency
selected for the current website. This header can be used to specify another
currency. The list of available currency codes can be received via the
Note: This header is available for OroCommerce Enterprise Edition only. |