API Documentation

WateBase provides a RESTful API to interact with your SQLite databases as hierarchical JSON stores. It is designed for high performance, simplicity, and microservice integration.


📦 JSON-Native Storage

Every interaction with WateBase is built on JSON. You can store and transmit any structure supported by the JSON standard:

  • Objects (Dictionaries) and Arrays (Lists)
  • Strings, Numbers, Booleans, and null

The database automatically converts your URL paths into a hierarchy. For example, a path like zoo/mammals/elephant will create a nested structure starting from the root of your database.

Base URL: https://wkdb.wk19.lol


Authentication

Every request to the API must include the X-API-Key header. You can generate keys in your Dashboard.

Header: X-API-Key: YOUR_API_KEY



1. Get Data

GET
/api/v2/{path}

Retrieves data from a specific path. If the path points to a node with children, the entire JSON tree is returned.

url = "https://wkdb.wk19.lol/api/v2/"
r = requests.get(f"{url}animals/cat", headers={"X-API-Key": "KEY"})
print(r.json())
url = "https://wkdb.wk19.lol/api/v2/"
async with session.get(f"{url}animals/cat", headers={"X-API-Key": "KEY"}) as r:
    data = await r.json()
    print(data)
url := "https://wkdb.wk19.lol/api/v2/animals/cat"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Set("X-API-Key", "KEY")
resp, _ := http.DefaultClient.Do(req)
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
var req = UnityWebRequest.Get("https://wkdb.wk19.lol/api/v2/animals/cat");
req.SetRequestHeader("X-API-Key", "KEY");
await req.SendWebRequest();
Debug.Log(req.downloadHandler.text);
RestClient.Request(new RequestHelper {
    Uri = "https://wkdb.wk19.lol/api/v2/animals/cat",
    Headers = new Dictionary<string, string> {
        { "X-API-Key", "KEY" }
    }
}).Then(res => {
    Debug.Log(res.Text);
});

2. Set Data

POST
/api/v2/{path}

Creates or overwrites data. The request body must contain a "value" wrapper.

url = "https://wkdb.wk19.lol/api/v2/"
payload = {"value": {"name": "cat", "legs": 4}}
r = requests.post(f"{url}animals/cat", json=payload, headers={"X-API-Key": "KEY"})
print(r.json())
url = "https://wkdb.wk19.lol/api/v2/"
payload = {"value": {"name": "cat", "legs": 4}}
async with session.post(f"{url}animals/cat", json=payload, headers={"X-API-Key": "KEY"}) as r:
    data = await r.json()
    print(data)
url := "https://wkdb.wk19.lol/api/v2/animals/cat"
body := strings.NewReader(`{"value":{"name":"cat","legs":4}}`)
req, _ := http.NewRequest("POST", url, body)
req.Header.Set("X-API-Key", "KEY")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
b, _ := io.ReadAll(resp.Body)
fmt.Println(string(b))
var json = "{\"value\":{\"name\":\"cat\",\"legs\":4}}";
var req = new UnityWebRequest("https://wkdb.wk19.lol/api/v2/animals/cat", "POST");
req.uploadHandler = new UploadHandlerRaw(Encoding.UTF8.GetBytes(json));
req.downloadHandler = new DownloadHandlerBuffer();
req.SetRequestHeader("X-API-Key", "KEY");
req.SetRequestHeader("Content-Type", "application/json");
await req.SendWebRequest();
Debug.Log(req.downloadHandler.text);
RestClient.Post("https://wkdb.wk19.lol/api/v2/animals/cat",
    new { value = new { name = "cat", legs = 4 } },
    new RequestHelper {
        Headers = new Dictionary<string, string> {
            { "X-API-Key", "KEY" },
            { "Content-Type", "application/json" }
        }
    }
).Then(res => {
    Debug.Log(res.Text);
});

3. Batch Update

POST
/api/v2/set_data_batch/{base_path}

Updates multiple nodes simultaneously under a base_path.

url = "https://wkdb.wk19.lol/api/v2/"
payload = {
    "cat": {"name": "cat", "legs": 4},
    "dog": {"name": "dog", "legs": 4}
}
r = requests.post(f"{url}animals", json=payload, headers={"X-API-Key": "KEY"})
print(r.json())
url = "https://wkdb.wk19.lol/api/v2/"
payload = {
    "cat": {"name": "cat", "legs": 4},
    "dog": {"name": "dog", "legs": 4}
}
async with session.post(f"{url}animals", json=payload, headers={"X-API-Key": "KEY"}) as r:
    data = await r.json()
    print(data)
url := "https://wkdb.wk19.lol/api/v2/animals"
body := strings.NewReader(`{"cat":{"name":"cat","legs":4},"dog":{"name":"dog","legs":4}}`)
req, _ := http.NewRequest("POST", url, body)
req.Header.Set("X-API-Key", "KEY")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
b, _ := io.ReadAll(resp.Body)
fmt.Println(string(b))
var json = "{\"cat\":{\"name\":\"cat\",\"legs\":4},\"dog\":{\"name\":\"dog\",\"legs\":4}}";
var req = new UnityWebRequest("https://wkdb.wk19.lol/api/v2/animals", "POST");
req.uploadHandler = new UploadHandlerRaw(Encoding.UTF8.GetBytes(json));
req.downloadHandler = new DownloadHandlerBuffer();
req.SetRequestHeader("X-API-Key", "KEY");
req.SetRequestHeader("Content-Type", "application/json");
await req.SendWebRequest();
Debug.Log(req.downloadHandler.text);
RestClient.Post("https://wkdb.wk19.lol/api/v2/animals",
    new {
        cat = new { name = "cat", legs = 4 },
        dog = new { name = "dog", legs = 4 }
    },
    new RequestHelper {
        Headers = new Dictionary<string, string> {
            { "X-API-Key", "KEY" },
            { "Content-Type", "application/json" }
        }
    }
).Then(res => {
    Debug.Log(res.Text);
});

4. Delete Data

DELETE
/api/v2/{path}

Removes a node and all of its children from the database. This action is permanent.

url = "https://wkdb.wk19.lol/api/v2/"
r = requests.delete(f"{url}animals/cat", headers={"X-API-Key": "KEY"})
print(r.json())
url = "https://wkdb.wk19.lol/api/v2/"
async with session.delete(f"{url}animals/cat", headers={"X-API-Key": "KEY"}) as r:
    data = await r.json()
    print(data)
url := "https://wkdb.wk19.lol/api/v2/animals/cat"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Set("X-API-Key", "KEY")
resp, _ := http.DefaultClient.Do(req)
b, _ := io.ReadAll(resp.Body)
fmt.Println(string(b))
var req = UnityWebRequest.Delete("https://wkdb.wk19.lol/api/v2/animals/cat");
req.SetRequestHeader("X-API-Key", "KEY");
await req.SendWebRequest();
Debug.Log(req.downloadHandler.text);
RestClient.Delete("https://wkdb.wk19.lol/api/v2/animals/cat",
    new RequestHelper {
        Headers = new Dictionary<string, string> {
            { "X-API-Key", "KEY" }
        }
    }
).Then(res => {
    Debug.Log(res.Text);
});

Complete Examples

import requests

class WateBase:
    def __init__(self, base_url, api_key):
        self.base_url = base_url.rstrip("/") + "/"
        self.headers = {"X-API-Key": api_key}

    def get(self, path):
        return requests.get(self.base_url + path, headers=self.headers).json()

    def set(self, path, value):
        return requests.post(self.base_url + path, json={"value": value}, headers=self.headers).json()

    def set_batch(self, path, values):
        return requests.post(self.base_url + path, json=values, headers=self.headers).json()

    def delete(self, path):
        return requests.delete(self.base_url + path, headers=self.headers).json()


if __name__ == "__main__":
    db = WateBase("https://wkdb.wk19.lol/api/v2/", "KEY")
    print(db.set("animals/cat", {"name": "cat", "legs": 4}))
    print(db.get("animals/cat"))
    print(db.set_batch("animals", {"dog": {"name": "dog", "legs": 4}}))
    print(db.delete("animals/cat"))
import aiohttp
import asyncio

class WateBase:
    def __init__(self, base_url, api_key):
        self.base_url = base_url.rstrip("/") + "/"
        self.headers = {"X-API-Key": api_key}

    async def get(self, path):
        async with aiohttp.ClientSession(headers=self.headers) as s:
            async with s.get(self.base_url + path) as r:
                return await r.json()

    async def set(self, path, value):
        async with aiohttp.ClientSession(headers=self.headers) as s:
            async with s.post(self.base_url + path, json={"value": value}) as r:
                return await r.json()

    async def set_batch(self, path, values):
        async with aiohttp.ClientSession(headers=self.headers) as s:
            async with s.post(self.base_url + path, json=values) as r:
                return await r.json()

    async def delete(self, path):
        async with aiohttp.ClientSession(headers=self.headers) as s:
            async with s.delete(self.base_url + path) as r:
                return await r.json()


async def main():
    db = WateBase("https://wkdb.wk19.lol/api/v2/", "KEY")
    print(await db.set("animals/cat", {"name": "cat", "legs": 4}))
    print(await db.get("animals/cat"))
    print(await db.set_batch("animals", {"dog": {"name": "dog", "legs": 4}}))
    print(await db.delete("animals/cat"))

asyncio.run(main())
package main

import (
	"bytes"
	"fmt"
	"io"
	"net/http"
)

type WateBase struct {
	BaseURL string
	ApiKey  string
}

func (w *WateBase) request(method, path string, body []byte) string {
	req, _ := http.NewRequest(method, w.BaseURL+path, bytes.NewBuffer(body))
	req.Header.Set("X-API-Key", w.ApiKey)
	req.Header.Set("Content-Type", "application/json")
	resp, _ := http.DefaultClient.Do(req)
	b, _ := io.ReadAll(resp.Body)
	return string(b)
}

func (w *WateBase) Get(path string) string {
	return w.request("GET", path, nil)
}

func (w *WateBase) Set(path string, json string) string {
	return w.request("POST", path, []byte(json))
}

func (w *WateBase) SetBatch(path string, json string) string {
	return w.request("POST", path, []byte(json))
}

func (w *WateBase) Delete(path string) string {
	return w.request("DELETE", path, nil)
}

func main() {
	db := WateBase{BaseURL: "https://wkdb.wk19.lol/api/v2/", ApiKey: "KEY"}
	fmt.Println(db.Set("animals/cat", `{"value":{"name":"cat","legs":4}}`))
	fmt.Println(db.Get("animals/cat"))
	fmt.Println(db.SetBatch("animals", `{"dog":{"name":"dog","legs":4}}`))
	fmt.Println(db.Delete("animals/cat"))
}
using UnityEngine;
using UnityEngine.Networking;
using System.Text;
using System.Collections;

public class WateBase
{
    string baseUrl;
    string apiKey;

    public WateBase(string baseUrl, string apiKey)
    {
        this.baseUrl = baseUrl.EndsWith("/") ? baseUrl : baseUrl + "/";
        this.apiKey = apiKey;
    }

    IEnumerator Request(string method, string path, string json)
    {
        var req = new UnityWebRequest(baseUrl + path, method);
        if (json != null)
            req.uploadHandler = new UploadHandlerRaw(Encoding.UTF8.GetBytes(json));
        req.downloadHandler = new DownloadHandlerBuffer();
        req.SetRequestHeader("X-API-Key", apiKey);
        req.SetRequestHeader("Content-Type", "application/json");
        yield return req.SendWebRequest();
        Debug.Log(req.downloadHandler.text);
    }

    public IEnumerator Get(string path) => Request("GET", path, null);
    public IEnumerator Set(string path, string json) => Request("POST", path, json);
    public IEnumerator SetBatch(string path, string json) => Request("POST", path, json);
    public IEnumerator Delete(string path) => Request("DELETE", path, null);
}

public class Main : MonoBehaviour
{
    void Start()
    {
        var db = new WateBase("https://wkdb.wk19.lol/api/v2/", "KEY");
        StartCoroutine(db.Set("animals/cat", "{\"value\":{\"name\":\"cat\",\"legs\":4}}"));
        StartCoroutine(db.Get("animals/cat"));
        StartCoroutine(db.SetBatch("animals", "{\"dog\":{\"name\":\"dog\",\"legs\":4}}"));
        StartCoroutine(db.Delete("animals/cat"));
    }
}
using Proyecto26;
using System.Collections.Generic;
using UnityEngine;

class WateBase
{
    string baseUrl;
    Dictionary<string, string> headers;

    public WateBase(string baseUrl, string apiKey)
    {
        this.baseUrl = baseUrl.EndsWith("/") ? baseUrl : baseUrl + "/";
        headers = new Dictionary<string, string> { { "X-API-Key", apiKey } };
    }

    public void Get(string path)
    {
        RestClient.Request(new RequestHelper { Uri = baseUrl + path, Headers = headers })
            .Then(r => Debug.Log(r.Text));
    }

    public void Set(string path, object body)
    {
        RestClient.Post(baseUrl + path, body, new RequestHelper { Headers = headers })
            .Then(r => Debug.Log(r.Text));
    }

    public void SetBatch(string path, object body)
    {
        Set(path, body);
    }

    public void Delete(string path)
    {
        RestClient.Delete(baseUrl + path, new RequestHelper { Headers = headers })
            .Then(r => Debug.Log(r.Text));
    }
}

public class Main : MonoBehaviour
{
    void Start()
    {
        var db = new WateBase("https://wkdb.wk19.lol/api/v2/", "KEY");
        db.Set("animals/cat", new { value = new { name = "cat", legs = 4 } });
        db.Get("animals/cat");
        db.SetBatch("animals", new { dog = new { name = "dog", legs = 4 } });
        db.Delete("animals/cat");
    }
}
}