Stock Query by brand API Documentation

Authentication

All API requests require authentication using a Bearer token. You can find your API key in your GMK Online account settings. If you do not have one you will need to contact the GMK sales office to set one up.

Header Format:

Authorization: Bearer your-api-key-here

Endpoints

Stock Query by brand

POST /stock-query-by-brand.php

Parameters

Name Type Required Description
brand string Yes The brand code to query products for
format string No Response format (json, xml, csv, text). Defaults to json

Response Formats

{
    "status": "success",
    "data": {
        "brand": "example-brand",
        "products": [
            {
                "sku": "ABC123",
                "description": "Product Description",
                "stock_status": "IN_STOCK",
                "quantity": 10,
                "timestamp": "2025-03-04T15:38:15Z",
                "last_updated": "2025-03-04 15:38:15"
            }
        ]
    }
}

<?xml version="1.0"?>
<stock>
    <status>success</status>
    <data>
        <brand>example-brand</brand>
        <products>
            <product>
                <sku>ABC123</sku>
                <description>Product Description</description>
                <stock_status>IN_STOCK</stock_status>
                <quantity>10</quantity>
                <timestamp>2025-03-04T15:38:15Z</timestamp>
                <last_updated>2025-03-04 15:38:15</last_updated>
            </product>
        </products>
    </data>
</stock>

sku,description,stock_status,quantity,timestamp,last_updated
ABC123,"Product Description","IN_STOCK",10,"2025-03-04T15:38:15Z","2025-03-04 15:38:15"

brand: example-brand
Products:
ABC123: 10 - Product Description

Error Responses

The API may return the following error responses:

Status Code Description
401 Unauthorized Invalid or missing API key
400 Bad Request Missing brand parameter or invalid format specified

Error Response Format:

{
    "status": "error",
    "message": "Error description here"
}

Code Examples

curl -X POST \
  'https://api.gmk.co.uk/stock-query-by-cat' \
  -H 'Authorization: Bearer your-api-key-here' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d 'brand=example-brand&format=json'

$apiKey = 'your-api-key-here';
$brand = 'example-brand';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.gmk.co.uk/stock-query-by-cat');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query([
    'brand' => $brand,
    'format' => 'json'
]));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer ' . $apiKey
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$data = json_decode($response, true);

curl_close($ch);
Test the API

Use this form to test the API with your credentials.

Response:
No test run yet
Need Help?

If you need assistance with the API or have any questions, please contact our support team.

Contact Support