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.

Developer Tips

Developer Tips

This section is to help Cortex API client developers get coding and building their client applications as fast as possible.

Community Forums

Cortex API has a passionate client developer community. Go to the community to ask questions, assist your fellow client developers, share ideas, and so on. The community is located at: https://grep.elasticpath.com/community/developer_forums/cortex

Useful Third-Party Tools

This is an inexhaustive list of some tools client developers may find helpful for creating Cortex API applications.

  • jQuery - Supplies a JavaScript library to simplify code development.
  • JSONPath - Is a useful third-party tool for extracting specific information from a JSON object. This can save you from having to create your own methods to loop through JSON objects to retrieve data.

Tips for Developing Applications

ZOOM, ZOOM, ZOOM

Learn how to ZOOM: Zoom. Zoom allows you to batch multiple GET requests into a single HTTP request. This tool can drastically reduce the number of requests your client app needs to make.

Supported Client Programming Languages

Developers can use any programming language that supports HTTP requests and JSON parsing (Java, C#, PHP, Ruby, JavaScript, and so on) to create a Cortex API client application. Cortex API does not have client libraries developers that you need to download and install in order to build a client application. That said, Cortex API works particularly well with JavaScript clients.

Don't Construct URIs

Most APIs require client developers to construct complicated URIs in order to perform operations with the system. Cortex API is specifically designed so client developers don't have to do this. To perform operations, client developers follow the links returned by Cortex API in a specific order called a workflow. Following a workflow means you don't have to construct URIs because Cortex API is constructing them for you.

Why not construct URIs?

First, you don't need to because Cortex API builds the URIs for you. That's the benefit of a REST Level 3 API, the API returns the URI of the resource you would use for the next operation. For example, getting an item will return an item with an addtocartform link, which you can use to add the item to a cart. Other APIs require client developers to construct their own URIs to interact with the API, but ours doesn't. All you need to do is follow the API's workflows to interact with the system. Second, constructing your own URIs can be dangerous because if Cortex API is upgraded your client app will break. Coding your client app to follow workflows decouples your code from the API, so there is less chance your client will break if the API is upgraded.

Don't Construct Forms

Forms are how to perform actions such as adding an item to a cart, adding a cart to an order, searching for items, and so on. Follow the proper workflow when using forms, which is GET the form, fill the form out, and POST the form back to Cortex API For more information on how forms work, see Forms.

Why not construct forms?

First, Cortex API constructs the form for you so there is no need to create your own. Second, constructing your own forms can be dangerous because if the API is upgraded and the forms change, your constructed forms will break.

Minimize Requests

The less calls you make to Cortex API, the faster your application will work. You can reduce the number of calls by utilizing ?followLocation and ?zoom.

Start from Entry Points

Build your app to access at Cortex API through its API Entry Points.