API Overview

The Storehippo API is organized around REST. Our API has predictable, resource-oriented URLs, and uses message key HTTP response to indicate API success or errors. We use built-in HTTP features, like HTTP authentication  which are understood by off-the-shelf HTTP clients. We support cross-origin resource sharing, allowing you to interact securely with our API from a client-side web application. JSON is returned by all API responses.

How to call


// create a new cURL resource
$ch = curl_init();

// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "http://example.com/api/1/entity/ms.products");
curl_setopt($ch, CURLOPT_HTTPHEADER, array('access-key', 'access-key-name'));
curl_setopt($ch, CURLOPT_HEADER, 0); // do not bring headers
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// grab URL and pass it to the browser
$output = curl_exec($ch);
$products = json_decode($output);
print_r($products);

$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);


// close cURL resource, and free up system resources
curl_close($ch);
                                        

var request = require('request');
var options = {
    url: "http://example.com/api/1/entity/ms.products",
    headers: {}
}
options.headers['access-key'] = 'access-key-name';

request(options, function (err, response, body) {

    //console.log("Error >>>>> ", err);
    //console.log("Response >>>>> ", response);
    console.log("Body >>>>> ", body);

})
                                    

Authentication

There are two type of accessing StoreHippo API

1. Access Key

Authenticate your account when using the API by including your access-key key in the request header. Your API keys carry many privileges, so be sure to keep them secret!

Read more about access key how to generate and use here

2. OAuth 2

If you want to access API through app, then use OAuth 2 authorization process

Read more about OAuth 2 how to use here

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, taking at least these three query parameters: limit, start.

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 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.