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

URI Standards

URI Standards

HTTP Methods

Cortex API supports the following HTTP requests:

  • GET: Reads data from a resource.
  • POST: Creates new elements. For example, POSTing an item to a cart, creates a new lineitems resource.
  • DELETE: Remove elements. For example, deleting a lineitem from a cart removes the lineitem element from the user's cart.
  • PUT: Updates existing elements.

Anatomy of a URI

The image below shows a breakdown of a standard Cortex API URI request. This request is GETing the lineitems in a customer's cart.

URI_breakdown

The first part of the URI is the store's domain address. The next part is the name of the resource you are running the GET on, which in this case is the carts resource. The next part is the store's domain name. The next part, default, specifies the logged in user's cart (see below for a description of default). The next part, lineitems, is a subresource of carts.

The method returns a JSON object listing the lineitems in a user's cart.

Note: Encoded URIs

Actual URIs look like: http://www.onlinestore/carts/rockjam/j4rs36b3fykw6y6d5hhukfgx34. The alphanumeric string in the URI (j4rs36b3fykw6y6d5hhukfgx34) is an ID encoded by the store. The encoding is for security purposes.

default

The profiles and carts resources support default in the URI. For profiles, default evaluates to the logged in customer's I.D. While for carts, default evaluates to the logged in customer's cart I.D. For example, GET: http://www.onlinestore.com/carts/rockjam/default returns the logged in user's cart and GET: http://www.onlinestore.com/profiles/rockjam/default returns the logged in user's profile. The purposes for supporting default for these resources is that client developer are saved from having to track cart IDs and user IDs and the resources become API Entry Points.