A small API for working with numbers, built for learning how APIs work. See the API reference for every parameter, response and error.
Adds two numbers.
Generates Fibonacci numbers.
Generates random numbers between min and max.
Generates a range of numbers.
$ curl -H 'Content-Type: application/json' \
-d '{"start": 1, "stop": 10, "step": 2}' \
http://127.0.0.1:7001/range
{"result":[1,3,5,7,9]}
Multiply, add, average or sort a list of numbers.
$ curl -H 'Content-Type: application/json' \
-d '{"numbers": [5, 4, 3, 2, 1]}' \
http://127.0.0.1:7001/product
{"result":120}
Replace /product with /sum, /average or /sort.
Count, sum, mean, min and max of a list of numbers.
$ curl -H 'Content-Type: application/json' \
-d '{"numbers": [1, 2, 3, 4, 5]}' \
http://127.0.0.1:7001/stats
{"count":5,"sum":15,"mean":3.0,"min":1,"max":5}
Tells you who your token belongs to. A token is your username followed by
-token-123, e.g. alice-token-123.
$ curl -H 'Authorization: Bearer alice-token-123' http://127.0.0.1:7001/me
{"username":"alice"}
Save numbers under a name. Every user has their own store.
$ AUTH='Authorization: Bearer alice-token-123'
$ curl -H "$AUTH" -H 'Content-Type: application/json' \
-d '{"value": 42}' http://127.0.0.1:7001/store/x
{"value":42}
$ curl -X PUT -H "$AUTH" -H 'Content-Type: application/json' \
-d '{"value": 43}' http://127.0.0.1:7001/store/x
{"value":43}
$ curl -H "$AUTH" http://127.0.0.1:7001/store/x
{"value":43}
$ curl -H "$AUTH" http://127.0.0.1:7001/store
{"x":43}
$ curl -X DELETE -H "$AUTH" http://127.0.0.1:7001/store/x
{"ok":true}