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.
$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);
});
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 .
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.
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. |
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).
messages | It contain the list of messages for API. And message have the key and level. |
data | It contains the response body. |
paging | Paging is returned with list API. It contains the paging detail like start, limit, count, total etc |
error | It contain error message. Error message have the key and level. |
data | It contains the error response data. |
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.
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. |
API response for the list APIs have the following structure
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.
field | Name 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. |
operator | Operator determines the type of comparison for the given field. Following comparison operators are supported.
|
value | Value of the filter that need to be used for comparison while filtering. For operators like in operator, the value should be a an array. |
You can sort the records in the List APIs using by passing the sort paramter in query string.
?sort=name | sort the records by name in ascending order. |
?sort=-name | sort the records by name in descending order. |
?sort=name, -price | sort the records by name in ascending order. Records with same name will be sorted in decending order of price. |