Elastic Path Commerce APIs
URI Standards
The image below shows a breakdown of a standard Cortex URL. The example request retrieves a list of line items in a shopper’s cart
important
The URI Standard is being shown as a Reference only. You should not construct the URI when building a client application or consuming APIs. Start from API Entry Points, Follow links in API responses returned by Cortex, Use zoom
. For more details, please see the Developer guide on consuming cortex API
Request Method
Cortex uses HTTP methods to perform actions and invoke changes on a resource. Cortex supports the following HTTP methods:
GET
: Read a resourcePUT
: Update an existing resourcePOST
: Create a new resourceDELETE
: Delete a resource
Requests using unsupported methods return either status code 405 Method Not Allowed
or 403 Forbidden
.
Cortex supports JSON resource representations, so requests must set the HTTP Content-Type
header to application/json
. Requests without this header, or requests using another media type, will return the following status code: 415 Unsupported Media Type
.
For example, the following request retrieves a shopper’s shopping cart:
GET http://api.elasticpath.net/cortex/carts/mobee/default
Content-Type: application/json
Base URL
The API’s domain address.
Resource Family
The family that this resource belongs to. A resource family is made up of many individual resources.
A resource is an object with data, relationships to other resources, and methods that invoke actions. Cortex represents the resource’s data using a standard JSON format. In this format, properties represent the resource’s data and the links represent the relationships the resource has with other resources. Cortex uses standard HTTP methods to perform actions on a resource.
Resources can also be linked together into lists. A list is a special type of resource that represents a collection of related resources.
Scope
The store’s identifier, which is known as the store’s scope. Stores can have different scopes for the regions they sell in.
The scope
is an unique identifier for a store. Companies selling goods and services through Cortex may have different scopes for the regions they sell in. For example, mystore_US
, mystore_UK
. Scoping could also be aligned with other selling methods, such as by product line: product1_store, product2_store.
Resource Identifier
The unique identifier of the resource being retrieved, updated or deleted. This example uses default
, which is special keyword that redirects to the authenticated shopper’s default cart.
The default
is a keyword that is used instead of a resource identifier to discover a default resource. For example, the default keyword offers a way to find a shopper’s cart without needing to know a specific cart identifier. When the default keyword is used, Cortex returns a 307 Temporary Redirect
with a location to the default resource. This capability enables resources to be API Entry Points.
Subresource
A subresource is a resource that cannot exist without the existence of another resource. In this example, the line items of a shopper’s cart cannot exist with the cart itself.