POST /
{"command": "SET a 5" }
200 OK
{
}
Retrieving the value
POST /
{"command": "GET a" }
200 OK
{
"value": "5"
}
Retrieving a non-existing value
POST /
{"command": "GET abc" }
400 Bad Request
{
"error": "key does not exist"
}
POST /
{"command": "SET a 5 EX 20" }
200 OK
{ }
Retrieving the value before expiration
POST /
{"command": "GET a" }
200 OK
{
"value": "5"
}
Retrieving the value after expiration
POST /
{"command": "GET a" }
400 Bad Request
{
"error": "key does not exist"
}
Only set the key if it does not already exist.
POST /
{"command": "SET a 5 NX" }
- When key doesn't exists
200 OK
{
}
- When key does exists
400 Bad Request
{
"error": "key already exist"
}
Only set the key if it already exists.
POST /
{"command": "SET a 5 XX" }
- When key does exists
200 OK
{
}
- When key doesn't exists
400 Bad Request
{
"error": "key does not exist"
}
POST /
{"command": "QPUSH li 1 2 3" }
- When a new queue is created
200 OK
{
"value": "OK"
}
- Appends to the existing value
200 OK
{
"value": "OK"
}
POST /
{"command": "QPOP li" }
- When the queue is non-empty
200 OK
{
"value": "3"
}
- When the queue is empty
400 Bad Request
{
"error": "queue is empty"
}
- When the queue doesn't exists
400 Bad Request
{
"error": "queue is empty"
}
- Incorrect HTTP method/Endpoint
GET /
{"command": "GET a" }
405 Method Not Allowed
{
"error": "invalid request"
}
- POST request without body
POST /
Status: 422 Unprocessable Entity
{
"error": "invalid request"
}
- Invalid command
POST /
{"command": "SET a"}
400 Bad Request
{
"error": "invalid command"
}