Announcement: You can find the guides for Commerce 7.5 and later on the new Elastic Path Documentation site. This Developer Center contains the guides for Commerce 6.13.0 through 7.4.1.Visit new site

This version of Elastic Path Commerce is no longer supported or maintained. To upgrade to the latest version, contact your Elastic Path representative.

JSON Format

JSON Format

Cortex uses JSON to represent a resource's current state. JSON is the ideal choice for transferring structured data over networks because it's lightweight, programing language independent, and supported by a large number of third party tools.

Cortex JSON representations follow this format:
  • A self object
  • A set of properties specific to the resource being represented
  • An array of links to other resources
In general, a Cortex JSON representation looks like:
{
  "self": {
    "type": {string},
    "uri": {string},  
    "href": {string},
    "max-age": {number}
  },
  "resource-property-1" : {string|number|object|array|true|false},
  ...
  "resource-property-n" : {string|number|object|array|true|false},
  "links": [
    {
      "rel": {string},
      "rev": {string},
      "type": {string},
      "uri": {string},
      "href": {string}
    },
    ...
    {
      "rel": {string},
      "rev": {string},
      "type": {string},
      "uri": {string},
      "href": {string}
    }
  ]
}

JSON Format Properties

A self object returns with every JSON response. Self objects have these properties:

Property

Description

type The resource's type, which describes the properties the resource has.
uri The resource's Uniform Resource Identifier, which is a short string identifying the resource.
href The resource's hypertext reference, which is its fully qualified URL.
max-age The time (in seconds) that a response can be safely cached. A max-age of zero indicates that the response should not be cached.

An array of links returns with every JSON response. Links have a consistent order, so the client application should not need to sort the array. Each link has these properties:

Property

Description

rel

The relationship name, which describes the relationship between this resource and the resource the link points to. This name is stable and will not change.

rev

The reverse relationship name, which describes the reverse relationship between this resource and linked to resource; in other words, the relationship from the linked resource to this resource. For example:

Revs

The rev is the only link property that is optional. If the rev is present and you follow the link, the linked resource will have a link back to the original resource. If the rev is not present and you follow the link, the linked resource will not have a link back to the original resource.

type The linked resource's type, which describes the properties the resource has.
uri The linked resource's Uniform Resource Identifier, which is a short string identifying the resource.

href

The linked resource's hypertext reference, which is its fully qualified URL.