API - Browsing - Search¶
URL: /search/?q=pink+apples
Method: GET
Optional parameters: c=123&m=123&is=0 (c = category ID, m = manufacturer ID, is = in stock only)
$api_id = 1;
$api_key = 'testpass';
$hostname = 'https://example.com'; // no trailing slash
# fetch data
$url = '/search/?q=pink+apples';
$post_data = array();
$user_token = 'xxx'; // is required here. Get it from Your DB after Token generation
$extra_headers = array(
'X-API-ID: ' . $api_id,
'X-API-Hash: ' . md5($api_key . $url. http_build_query($post_data)),
'X-User-Token: ' . $user_token
);
header('Content-Type: application/json; charset=utf-8');
echo sendRequest($hostname . $url, $post_data, $extra_headers);
Succes message:
{ has_error: false, messages: { section: "search" }, results: { lastpage: 11, nopageurl: "search", search: {}, totalproducts: "227", pagination: [] } }
Go to top