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
POST /stock-query-by-cat.php
| Name | Type | Required | Description |
|---|---|---|---|
| category | string | Yes | The category code to query products for |
| format | string | No | Response format (json, xml, csv, text). Defaults to json |
{
"status": "success",
"data": {
"category": "example-category",
"products": [
{
"sku": "ABC123",
"description": "Product Description",
"stock_status": "IN_STOCK",
"image": "IMAGE_URL",
"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>
<category>example-category</category>
<products>
<product>
<sku>ABC123</sku>
<description>Product Description</description>
<stock_status>IN_STOCK</stock_status>
<image>IMAGE_URL</image>
<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,image,quantity,timestamp,last_updated
ABC123,"Product Description","IN_STOCK","IMAGE_URL",10,"2025-03-04T15:38:15Z","2025-03-04 15:38:15"
Category: example-category
Products:
ABC123: 10 - Product Description
The API may return the following error responses:
| Status Code | Description |
|---|---|
| 401 Unauthorized | Invalid or missing API key |
| 400 Bad Request | Missing category parameter or invalid format specified |
Error Response Format:
{
"status": "error",
"message": "Error description here"
}
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 'category=example-category&format=json'
$apiKey = 'your-api-key-here';
$category = 'example-category';
$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([
'category' => $category,
'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);
Use this form to test the API with your credentials.
No test run yet
If you need assistance with the API or have any questions, please contact our support team.
Contact Support