StoreHippo API

Overview

StoreHippo uses microservices architecture and exposes REST API endpoints for almost all actions that can be performed on the platform. Even your Storefront interacts with the StoreHippo platform through API (StoreHippo is first SaaS platform to use Single Page Architecture. Read more about StoreHippo technology here). Our API endpoints have perdictable resource-oriented URLs, accept JSON in request body and returns JSON response.

How to call


$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "https:/{storename}.storehippo.com/api/1.1/entity/ms.products");
curl_setopt($ch, CURLOPT_HTTPHEADER, array('access-key', '{access-key}'));
curl_setopt($ch, CURLOPT_HEADER, 0); // do not bring headers
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$output = curl_exec($ch);
$products = json_decode($output);
print_r($products);

$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
 
 
var request = require('request');
var options = {
    url: "https://{storename}.storehippo.com/api/1.1/entity/ms.products",
    headers: {
        "access-key": "{access-key}"
    }
}
request(options, function (err, response, body) {
    var output = JSON.parse(body);
    console.log(output);
});

Authentication

StoreHippo uses Access Keys to authenticate API requests. You can view and manage your API access keys in your StoreHippo Dashboard.

Authenticate your API requests by passing your access key in the access-key header of your HTTP request.

Your API keys carry many privileges, so be sure to keep them secret!

If you want to access API endpoints through a StoreHippo app, then use must use OAuth 2 authorization .

API Request

StoreHippo Request facilitates communication with remote HTTP servers via the browser's XMLHttpRequest object. XMLHttpRequest (XHR) is an API in the form of an object whose methods transfer data between a web browser and a web server.

Configs

data : {Object}Object containing data you want to send with the request.
headers : {Object}Can be used to define the headers to use with the request. 'access-key' and 'backend' can be passed through the request headers.
query : {Object}Define extra options to be defined to get the desired response only. 'filters', 'start', 'limit', 'sort' can be passed to the query object.

API Response

Storehippo uses conventional HTTP response codes to indicate the success or failure of an API request. In general, codes in the 2xx range indicate success, codes in the 4xx range indicate an error that failed given the information provided (e.g., a required parameter was omitted, a validation failed, etc.), and codes in the 5xx range indicate an error with Storehippo's servers (these are rare).

Success API Response

messagesIt contain the list of messages for API. And message have the key and level.
dataIt contains the response body.
pagingPaging is returned with list API. It contains the paging detail like start, limit, count, total etc

Error API Response

errorIt contain error message. Error message have the key and level.
dataIt contains the error response data.

Pagination

All top-level API resources have support for bulk fetches via "list" API methods. For instance you can list products, list customers, and list orders. These list API methods share a common structure for pagination.

Request

You can use following query parameters in the API request to implement pagination.

limit
Default Value : 50

Required: No
A limit on the number of records to be returned.
start
Default Value : 0

Required: No
A limit on the number of records to be skipped before returning.

Response

API response for the list APIs have the following structure

Filtering

You can filter the records in the List APIs using filters. Filters are passed in query string. You can pass multiple filters in the same API request. Every filter in the filters array has field, operator(optional) and value fields.

fieldName of the field used. You can have only one filter for one field. If you need to filter based on multiple values of the same field then use in operator.
operatorOperator determines the type of comparison for the given field. Following comparison operators are supported.
  • equal (default)
  • not_equal
  • less_than
  • greater_than
  • in
valueValue of the filter that need to be used for comparison while filtering. For operators like in operator, the value should be a an array.

Sorting

You can sort the records in the List APIs using by passing the sort paramter in query string.

Examples

?sort=namesort the records by name in ascending order.
?sort=-namesort the records by name in descending order.
?sort=name, -pricesort the records by name in ascending order. Records with same name will be sorted in decending order of price.