Skip to content
Command Palette
Search for a command to run...
QuizBase · Docs

Other languages#

Beyond TypeScript and the MCP server, there’s no official SDK. The API is small enough that a community wrapper or plain HTTP client is often the right call.

Community SDKs#

None yet. We’ll list them here as they appear. If you’ve published one, let us know.

Use the HTTP client you already have#

Every language with an HTTP client can hit QuizBase in 5 lines. Examples:

Python#

import os, requests

r = requests.get(
    'https://quizbase.runriva.com/api/v1/questions/random',
    params={'amount': 5, 'lang': 'pl', 'difficulty': 'medium'},
    headers={'X-API-Key': os.environ['QUIZBASE_KEY']},
)
r.raise_for_status()
for q in r.json()['data']:
    print(q['text'])

For production use requests.Session with HTTPAdapter(max_retries=Retry(...)) configured to honor Retry-After.

Go#

package main

import (
    "encoding/json"
    "fmt"
    "net/http"
    "os"
)

type Question struct {
    ID            string   `json:"id"`
    Text          string   `json:"text"`
    CorrectAnswer string   `json:"correctAnswer"`
    Language      string   `json:"language"`
}

type Response struct {
    Data []Question `json:"data"`
}

func main() {
    req, _ := http.NewRequest("GET",
        "https://quizbase.runriva.com/api/v1/questions/random?amount=5&lang=pl", nil)
    req.Header.Set("X-API-Key", os.Getenv("QUIZBASE_KEY"))

    res, err := http.DefaultClient.Do(req)
    if err != nil {
        panic(err)
    }
    defer res.Body.Close()

    var body Response
    json.NewDecoder(res.Body).Decode(&body)
    for _, q := range body.Data {
        fmt.Println(q.Text)
    }
}

Rust#

use reqwest::blocking::Client;
use serde_json::Value;
use std::env;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let key = env::var("QUIZBASE_KEY")?;
    let res: Value = Client::new()
        .get("https://quizbase.runriva.com/api/v1/questions/random")
        .header("X-API-Key", key)
        .query(&[("amount", "5"), ("lang", "pl")])
        .send()?
        .json()?;

    for q in res["data"].as_array().unwrap() {
        println!("{}", q["text"].as_str().unwrap());
    }
    Ok(())
}

Ruby#

require 'net/http'
require 'json'
require 'uri'

uri = URI('https://quizbase.runriva.com/api/v1/questions/random')
uri.query = URI.encode_www_form(amount: 5, lang: 'pl', difficulty: 'medium')

req = Net::HTTP::Get.new(uri)
req['X-API-Key'] = ENV['QUIZBASE_KEY']

res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(req) }
JSON.parse(res.body)['data'].each { |q| puts q['text'] }

curl#

Always works:

curl -H "X-API-Key: $QUIZBASE_KEY" 
     "https://quizbase.runriva.com/api/v1/questions/random?amount=5&lang=pl"

OpenAPI spec#

The OpenAPI 3.1 spec ships alongside the TypeScript SDK. You’ll be able to generate clients for your language with openapi-generator, openapi-typescript, or similar.

See also#