Filters, search & pagination
Every dataset accepts the same small set of query parameters. They can be combined freely.
Parameters#
| Parameter | Description |
|---|---|
?field=value | Filter by any string field, for example ?type=Keycard |
?search=ak | Full-text search across the record fields |
?sort=name:asc | Sort by a field, asc or desc |
?page=2&per_page=20 | Paginate. per_page defaults to 50 and caps at 500 |
?dataset=weapons | Limit search to one or more comma-separated datasets |
?fields=name,type | Search only selected comma-separated fields |
?fuzzy=true | Tolerate small spelling differences. Needs 1–3 explicit datasets |
?limit=10 | Limit matches per dataset in search. Maximum 50 |
Combine them#
curl "https://gzw-data.dev/api/v1/keys?type=Keycard&search=alpha&page=1&per_page=20"const res = await fetch("https://gzw-data.dev/api/v1/keys?type=Keycard&search=alpha&page=1&per_page=20");
const { data } = await res.json();import requests
data = requests.get("https://gzw-data.dev/api/v1/keys?type=Keycard&search=alpha&page=1&per_page=20").json()["data"]Search across datasets#
curl "https://gzw-data.dev/api/v1/search?q=AK&dataset=weapons&limit=5"Numeric values#
Records may include an additive numeric_values object for unambiguous unit-bearing fields. Original source strings are always kept.
weapons/ak-12 (excerpt)
"weight": "3.553 kg",
"numeric_values": { "weight": { "value": 3.553, "unit": "kg" } }