Get a verified code sample
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.
Example usage
- 1
A person asks
- Show me how to list firearms from the GunSpec API in Python.
- 2
The assistant calls the tool
tools/calljson{ "name": "gunspec_code_sample", "arguments": { "path": "/v1/firearms", "method": "GET", "language": "python" }} - 3
The server answers
No captured answer is available for this tool yet.
Related references
Arguments
- stringrequired
The endpoint path, e.g. "/v1/firearms" or "/v1/firearms/{id}".
- Sent as
- ?path=
- string
HTTP method, when the path answers more than one.
- Accepts
- Sent as
- ?method=
- stringrequired
The language or SDK the sample is wanted in.
- Accepts
- Sent as
- ?language=
Each argument is sent to GET /v1/docs/samples as the parameter shown, so the same request can be made to the API directly, with your key, if you want to shape what comes back.