GunSpec

Alle 39 Einzel-Tools

Get a verified code sample

  • gunspec_code_sample
  • Explorer
  • Nur lesend

Returns the code sample the GunSpec API reference prints for an endpoint in one language, exactly as printed, with when it was last checked against production. Languages: curl, javascript (TypeScript with fetch), python (requests), unity, unreal, godot, sdk-typescript and sdk-python for the official SDKs. Use this tool when the user wants code that calls the GunSpec API, and give them the sample as returned rather than writing one. Replace your_key with the user's key as the keyNote says.

Anwendungsbeispiel

  1. 1

    Eine Person fragt

    • Show me how to list firearms from the GunSpec API in Python.
  2. 2

    Der Assistent ruft das Tool auf

    tools/call
    json
    {  "name": "gunspec_code_sample",  "arguments": {    "path": "/v1/firearms",    "method": "GET",    "language": "python"  }}
  3. 3

    Der Server antwortet

    Ergebnis
    json
    {  "method": "GET",  "path": "/v1/firearms",  "tier": "explorer",  "docsUrl": "https://docs.gunspec.io/en/api/firearms/list",  "language": "python",  "keyNote": "Replace your_key with a GunSpec API key, sent as the X-API-Key header (Authorization: Bearer also works).",  "samples": [    {      "label": "Python (requests)",      "code": "import requests\n\nheaders = {\"X-API-Key\": \"your_key\"}\nres = requests.get(\"https://api.gunspec.io/v1/firearms?category=pistol\", headers=headers)\ndata = res.json()[\"data\"]\nprint(data)",      "verification": {        "status": "passed",        "checkKind": "executed",        "ranAt": "2026-10-19T09:23:32.942Z"      },      "note": null    }  ]}

    Am 22. Okt. 2026 von der Live-API erfasst.

Zugehörige Referenzen

Argumente

  • stringerforderlich

    The endpoint path, e.g. "/v1/firearms" or "/v1/firearms/{id}".

    Gesendet als
    ?path=
  • string

    HTTP method, when the path answers more than one.

    Akzeptiert
    Gesendet als
    ?method=
  • stringerforderlich

    The language or SDK the sample is wanted in.

    Akzeptiert
    Gesendet als
    ?language=

Jedes Argument wird als der angegebene Parameter an GET /v1/docs/samples gesendet. Dieselbe Anfrage lässt sich also mit deinem Schlüssel direkt an die API stellen, wenn du bestimmen möchtest, was zurückkommt.

json