Skip to content
This repository has been archived by the owner on Jun 15, 2022. It is now read-only.

API Documentation

Gökhan Özeloğlu edited this page Oct 16, 2021 · 1 revision

/set - POST

To set key-value pair, /set endpoint can be used with JSON object.

Example:

/set
Example: http://localhost:1234/set
Body:
{
    "data": [
        {
            "key": "foo",
            "value": "bar"
        }
    ]
}

Successful response:
{
    "key": "",
    "value": "",
    "result": "OK"
}

Possible status codes:

Status Code HTTP Meaning kvs Meaning
200 Success Key-value pair is set successfully.
400 Bad Request HTTP method or JSON body's format is wrong.
500 Internal Server Error Encountered unexpected condition while reading body or marshaling response.

/get/<key> - GET

To get the value of the key, /get endpoint can be used with <key> in URL.

Example:

/get/<key>
Example: http://localhost:1234/get/foo


Successful response:
{
    "key": "foo",
    "value": "bar",
    "result": "OK"
}

Possible status codes:

Status Code HTTP Meaning kvs Meaning
200 Success Value is returned successfully.
400 Bad Request HTTP method is wrong or key is missing in the endpoint.
500 Internal Server Error Encountered unexpected condition while reading body or marshaling response.

/save - PUT

To save the data that stores in memory to disk, /save endpoint can be used.

Example:

/save
Example: http://localhost:1234/save


Successful response:
{
    "key": "",
    "value": "",
    "result": "Saved"
}

Possible status codes:

Status Code HTTP Meaning kvs Meaning
200 Success Data that stores in memory saved successfully.
400 Bad Request HTTP method is wrong.
500 Internal Server Error Encountered unexpected condition while reading body or marshaling response.
Clone this wiki locally