Loading...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72

🎨 Change the colors!

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.


🗨 Examples

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'})


🚀 About

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