DataKey // MANUAL

INTERFACE SPECIFICATION

All interactions are performed via HTTP POST requests.

ENDPOINT: LOADING.../api


IMPLEMENTATION EXAMPLES

Replace YOUR_DATAKEY_URL with the url generated on the home page (e.g., datakey://...).

1. Python (Requests)

import requests

url = "http://localhost:3000/api"
payload = {
    "url": "YOUR_DATAKEY_URL",
    "action": "set",  # or "read"
    "key": "target_key",
    "value": "secret_data"
}

response = requests.post(url, json=payload)

print(f"Status: {response.status_code}")
print(f"Response: {response.text}")

2. Python (Standard Lib - Urllib)

import urllib.request
import json

url = "http://localhost:3000/api"
data = {
    "url": "YOUR_DATAKEY_URL",
    "action": "set",
    "key": "target_key",
    "value": "secret_data"
}

req = urllib.request.Request(url)
req.add_header('Content-Type', 'application/json')
jsondata = json.dumps(data).encode('utf-8')

try:
    with urllib.request.urlopen(req, jsondata) as f:
        print(f.read().decode('utf-8'))
except Exception as e:
    print(e)

3. JavaScript (Node.js / Browser Fetch)

async function interact() {
    const url = "http://localhost:3000/api";
    const payload = {
        url: "YOUR_DATAKEY_URL",
        action: "set",
        key: "target_key",
        value: "secret_data"
    };

    const res = await fetch(url, {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify(payload)
    });

    const text = await res.text();
    console.log(text);
}

interact();

4. CLI (cURL)

curl -X POST http://localhost:3000/api \
     -H "Content-Type: application/json" \
     -d '{"url": "YOUR_DATAKEY_URL", "action": "set", "key": "target_key", "value": "secret_data"}'

PARAMETER REFERENCE

POST /api

Headers:
  Content-Type: application/json

Body (JSON):
{
  "url": "datakey://{30-hex-string}.kv.db",
  "action": "read" | "set",
  "key": "string",
  "value": "string" // Required only for 'set'
}