Simple REST API for the in-memory data store.
http://localhost:8080
POST /strings
Content-Type: application/json
{
"key": "username",
"value": "john",
"ttl": 3600 // optional, seconds
}GET /strings/{key}PUT /strings/{key}
Content-Type: application/json
{
"value": "new_value"
}POST /lists
Content-Type: application/json
{
"key": "items",
"value": ["apple", "banana"],
"ttl": 3600 // optional, seconds
}GET /lists/{key}POST /lists/{key}/push
Content-Type: application/json
{
"value": "orange"
}POST /lists/{key}/popDELETE /keys/{key}Success:
{
"success": true,
"data": "result"
}Error:
{
"success": false,
"error": "Error message"
}# Set a string
curl -X POST http://localhost:8080/strings \
-H "Content-Type: application/json" \
-d '{"key":"user","value":"john"}'
# Get the string
curl http://localhost:8080/strings/user
# Create a list
curl -X POST http://localhost:8080/lists \
-H "Content-Type: application/json" \
-d '{"key":"items","value":["apple","banana"]}'
# Add to list
curl -X POST http://localhost:8080/lists/items/push \
-H "Content-Type: application/json" \
-d '{"value":"orange"}'
# Remove from list
curl -X POST http://localhost:8080/lists/items/pop
# Delete key
curl -X DELETE http://localhost:8080/keys/user