Just call the API (using Postman or cURL):
| Method | POST |
|---|---|
| URL | https://apix.xmm.fr/cell/{cellId} |
| Params |
In URL (above): cellId (integer): target cell id In query: color (string): HTML color name |
| Response |
200: success 405: invalid input |
Please note that the color name "random" is accepted. Also, after you change a cell color, it is randomized again after 30 seconds.
Let's change cell 42 color to green using cURL:
curl -X POST https://apix.xmm.fr/cell/42?color=green
Now let's animate a vertical line moving from left to right with a simple Python script:
import requests
import time
# Set all cells to white
for i in range(1, 6 * 12 + 1):
requests.post('https://apix.xmm.fr/cell/' + str(i), params = {'color':'white'})
# Wait for 2 seconds
time.sleep(2)
# Do the actual animation
for i in range(1, 6 + 1):
for j in range(i, 6 * (12 - 1) + i + 1, 6):
requests.post('https://apix.xmm.fr/cell/' + str(j), params = {'color':'yellow'})
time.sleep(1)
for j in range(i, 6 * (12 - 1) + i + 1, 6):
requests.post('https://apix.xmm.fr/cell/' + str(j), params = {'color':'white'})
Apix is a friendly app to learn how to use APIs: with just a simple API call, you change the colors of cells ("pixels") in a board. You can create images and even animations!
It is really in beta state, meaning that it is an unfinished product as of now. Notably, there are no basic security features you should expect from a proper API Gateway such as authentication, throttling or strong input validation.
Have a question? Want a feature? Found a bug? Contact me at olivier.daunis@gmail.com
Apix © OZ 2019