The following instructions show how to use our API to easily develop a site that offers a seamless catalog of products with live product inventory and prices.

1.      Get your Api Key.

 

A key is required to access the HLC API. If you already possess one, continue to step 2. Otherwise, follow the instructions in the Security section or contact our customer support team.

 

2.      Choose your programming language.

HLC’s API is built with RESTFul architecture, so the site doesn’t depend on a specific language, as long the language can execute http requests. The following examples use the C# languages as well as Javascript.

 

3.      Create a site supporting your programming language.

The HLC API platform requires a site hosted by a Web Server. Numerous hosting plans are available on the Web at low costs, or you can host the site yourself.

 

4.      Store the static information into a cache engine.

Efficient sites minimize the number of calls they process, e.g. you want to specifically avoid those that are heavy. Easily achieve this by storing information in a cache engine so it can be retrieved later. Many cache systems exist, though the right one depends on your programming language

We strongly recommend daily caching of the following data, retrieved from the following functions,

The complete list of our functions is available in the services section.

 

5.      Develop your interfaces.

A beautiful interface will improve the customer experience. Certain frameworks greatly improve UX, and we recommend Bootstrap and JQuery, or use a existing template from your hosted site platform.

 

6.      Use our CDN images.

HLC’s API liberates your system from image storage. We provide the final link within the response of the function Get /Catalog/Products:

[{ 
  "VariantNo": "020056-07", 
  "ProductNo": "020056", 
  "Images": [ 
      {"Format": "Original", 
      "Url": "https://cdn.hawleylambert.com/images/shared/Original/020056-07_1.jpg"}, 
      {"Format": "Large", "Url": "https://cdn.hawleylambert.com/images/shared/Large/020056-07_1.jpg" }, 
      { "Format": "Medium", "Url": "https://cdn.hawleylambert.com/images/shared/Medium/020056-07_1.jpg" }, 
      { "Format": "Small", "Url": "https://cdn.hawleylambert.com/images/shared/Small/020056-07_1.jpg" }, 
      { "Format": "Thumbnail", "Url": "https://cdn.hawleylambert.com/images/shared/Thumbnail/020056-07_1.jpg" }]
}]

Another way to retrieve images would be to call the function “Get /Catalog/Products/Images”. This function was optimized to return the images more quickly.

Five types of image exist:

  • Original : 900 pixels X 900 pixels
  • Large: 280 pixels X 280 pixels
  • Medium: 156 pixels X 156 pixels
  • Thumbnail: 60 pixels X 60 pixels
  • Small: 32 pixels X 32 pixels

At this point, we assume an interface showing products to visitors has been developed.

 

7.      Refresh the inventory frequently.

One way to improve the speed of your site is to show only the important information at first and then, load the rest of the content asynchronously. For example, inventory is the type of information that can be loaded asynchronously.

Inventory levels change quickly.  Each call must have the most up-to-date information. To do so, call the inventory function every time the user requests the page, or do any action, and limit the content by using the available parameters such as the variantNo and the dateFrom. By using those parameters, you decrease the amount of information sent across the internet, thus reducing the latency to obtain the results.

For instance, you could call: “/Catalog/Products/Inventory/?sku=123456-01”.

 

8.      Need more information ?

Continue your learning journey by visiting the following links :