└── README.md
/README.md:
--------------------------------------------------------------------------------
1 | # tinyCam app web server API
2 | This is official documentation of the REST API provided by tinyCam Monitor PRO web server - Android app for video surveillance.
3 | tinyCam web server uses API which is partially compatible with Axis IP cameras. You can use any IP camera viewer software to view tinyCam server remotely.
4 |
5 | ## Authentication
6 | tinyCam supports three types of authentication:
7 | ### 1. Basic authentication (legacy)
8 |
9 | Example:
10 | ```
11 | https://admin:mypassword@192.168.0.3:8083/axis-cgi/mjpg/video.cgi
12 | ```
13 |
14 |
15 | ### 2. Providing credentials as parameters
16 |
17 | GET parameters `user=&pwd=`
18 |
19 | * `user` (optional) - username,
20 | * `pwd` (optional) - password.
21 |
22 | Use it when there is no way to use basic authentication (e.g. for home automation).
23 |
24 | Example:
25 | ```
26 | https://192.168.0.3:8083/axis-cgi/mjpg/video.cgi?user=admin&pwd=mypassword
27 | ```
28 |
29 |
30 | ### 3. Token based authentication (recommended to use)
31 | Access: guest, admin
32 |
33 | GET `/api/v1/login?user=&pwd=`
34 |
35 | Example:
36 | ```
37 | https://192.168.0.3:8083/api/v1/login?user=admin&pwd=mypassword
38 | ```
39 |
40 | JSON payload:
41 | ```
42 | {
43 | "data": {
44 | "token": "d6bdc406225bf6bb6ecf720e97e8927acfe52022",
45 | "access": "admin"
46 | }
47 | }
48 | ```
49 |
50 | For subsequent requests, add `token` with token value returned in the login response.
51 |
52 | Example:
53 | ```
54 | https://192.168.0.3:8083/axis-cgi/mjpg/video.cgi?token=d6bdc406225bf6bb6ecf720e97e8927acfe52022
55 | ```
56 |
57 | ## Logout
58 | Access: guest, admin
59 |
60 | GET `/api/v1/logout?token=`
61 |
62 | Deletes authentication token.
63 |
64 | Example:
65 | ```
66 | https://192.168.0.3:8083/api/v1/logout?token=d6bdc406225bf6bb6ecf720e97e8927acfe52022
67 | ```
68 |
69 | ## Get camera list
70 | Access: guest, admin
71 |
72 | GET `/api/v1/get_cam_list?token=`
73 |
74 | Example:
75 | ```
76 | https://192.168.0.3:8083/api/v1/get_cam_list?token=d6bdc406225bf6bb6ecf720e97e8927acfe52022
77 | ```
78 |
79 | JSON payload:
80 | ```
81 | {
82 | "data": [{
83 | "name": "Front yard",
84 | "enabled": true,
85 | "id": 182399567,
86 | "ptzCapabilities": 230911,
87 | "audioListening": true,
88 | "cloudAccess": false
89 | }, {
90 | "name": "Doorbell",
91 | "enabled": true,
92 | "id": 1455317736,
93 | "ptzCapabilities": 32768,
94 | "audioListening": true,
95 | "cloudAccess": true
96 | }]
97 | }
98 | ```
99 |
100 |
101 | ## Get camera event list
102 | Access: guest, admin
103 |
104 | GET `/api/v1/get_cam_event_list?token=&cameraId=&endtime=&count=&type=&filter=`
105 | * `cameraId` (optional) - camera ID returned by `/api/v1/get_cam_list` request. If empty, events from all enabled cameras returned.
106 | * `endtime` (optional) - time (Unix timestamp in milliseconds) from which events should be returned
107 | * `count` (optional) - max number of events to get
108 | * `type` (optional) - `local` (default) or `cloud` events
109 | * `filter` (optional) - can be `pin`, `face`, `person`, `vehicle`, `pet`, `motion`, or `audio`. If empty, all events returned.
110 |
111 | List is returned in descending order (new events first).
112 |
113 | Example:
114 | ```
115 | https://192.168.0.3/api/v1/get_cam_event_list?token=d6bdc406225bf6bb6ecf720e97e8927acfe52022&cameraId=182399567&endtime=1601381164000&count=15&type=local&filter=person
116 | ```
117 |
118 | JSON payload:
119 | ```
120 | {
121 | "data": [{
122 | "time": 1601381164000,
123 | "duration": 120000,
124 | "motion": "person",
125 | "video": "\/api\/v1\/get_file?file=\/Front%20yard\/2020-09-29%2015.06.04%20120sec%20person.mp4",
126 | "image": "\/api\/v1\/get_file?file=\/Front%20yard\/2020-09-29%2015.06.04%20120sec%20person.mp4.jpg"
127 | }, {
128 | "time": 1601380363000,
129 | "duration": 58000,
130 | "motion": "person",
131 | "video": "\/api\/v1\/get_file?file=\/Front%20yard\/2020-09-29%2014.52.43%2058sec%20person.mp4",
132 | "image": "\/api\/v1\/get_file?file=\/Front%20yard\/2020-09-29%2014.52.43%2058sec%20person.mp4.jpg"
133 | }, {
134 | "time": 1601379016000,
135 | "duration": 54000,
136 | "motion": "person",
137 | "video": "\/api\/v1\/get_file?file=\/Front%20yard\/2020-09-29%2014.30.16%2054sec%20person.mp4",
138 | "image": "\/api\/v1\/get_file?file=\/Front%20yard\/2020-09-29%2014.30.16%2054sec%20person.mp4.jpg"
139 | }]
140 | }
141 | ```
142 |
143 | ## Get file
144 |
145 | GET `/api/v1/get_file?token=&file=`
146 |
147 | * `file` (mandatory) - filename returned by `/api/v1/get_cam_event_list` to be requested (image or video)
148 |
149 | Example:
150 | ```
151 | https://192.168.0.3/api/v1/get_file?file=/Front%20yard/2020-09-29%2010.51.26%2043sec%20motion.mp4.jpg&token=d6bdc406225bf6bb6ecf720e97e8927acfe52022
152 | ```
153 |
154 | ## Get status
155 | Access: admin
156 |
157 | GET `/api/v1/get_status?token=&cameraId=`
158 |
159 | * `cameraId` (optional) - camera ID returned by `/api/v1/get_cam_list` request. If empty, global status returned.
160 |
161 | Example:
162 | ```
163 | https://192.168.0.3/api/v1/get_status?token=d6bdc406225bf6bb6ecf720e97e8927acfe52022
164 | https://192.168.0.3/api/v1/get_status?token=d6bdc406225bf6bb6ecf720e97e8927acfe52022&cameraId=182399567
165 | ```
166 |
167 | Global JSON payload:
168 | ```
169 | {
170 | "data": {
171 | "backgroundMode": true,
172 | "cpuUsagePercents": 0,
173 | "cpuFrequencyMhz": 2014,
174 | "temperature": -1,
175 | "memoryAvailable": 1089949696,
176 | "memoryUsed": 490082304,
177 | "threadsUsed": 73,
178 | "threadsRunnableUsed": 20,
179 | "processes": [{
180 | "name": "UI",
181 | "memoryUsed": 38047744
182 | }, {
183 | "name": "Watchdog",
184 | "memoryUsed": 29640704
185 | }, {
186 | "name": "WebServer",
187 | "memoryUsed": 231104512
188 | }, {
189 | "name": "Background",
190 | "memoryUsed": 193558528
191 | }],
192 | "batteryLevel": 100,
193 | "batteryStatus": "charging",
194 | "uptime": 23160200,
195 | "networkInBps": 76103,
196 | "networkOutBps": 0,
197 | "streamProfile": 0,
198 | "powerSafeMode": false,
199 | "notifications": true,
200 | "rootAvailable": false,
201 | "spaceUsed": 4094579744,
202 | "spaceAvailable": 1849597952,
203 | "liveConnections": 1,
204 | "motionCameras": ["Front yard"]
205 | }
206 | }
207 | ```
208 |
209 | Camera JSON payload:
210 | ```
211 | {
212 | "data": {
213 | "motion": true
214 | }
215 | }
216 | ```
217 |
218 | ## Get MJPEG and JPEG video streams
219 | Access: guest, admin
220 |
221 | GET `/axis-cgi/mjpg/video.cgi`
222 |
223 | Used to request a Motion JPEG video stream with specified arguments.
224 |
225 | GET `/axis-cgi/jpg/image.cgi`
226 |
227 | Request for single JPEG.
228 |
229 | ```
230 | http:///axis-cgi/mjpg/video.cgi[?=[&=...]]
231 | http:///axis-cgi/jpg/image.cgi[?=[&=...]]
232 | ```
233 |
234 | Parameters:
235 | * `camera=` (optional) - select video source. 1..n.
236 | * `fps=` (optional) - image frame rate. 0 - unlimited.
237 | * `compression=` (optional) - adjust image compression level, 0..100. Higher values correspond to higher compression, that is lower quality and smaller image size.
238 | * `resolution=` (optional) - resolution [width]x[height] of the returned image, e.g. `640x480`.
239 |
240 |
241 | Examples:
242 | ```
243 | http://192.168.0.3:8083/axis-cgi/mjpg/video.cgi
244 | http://192.168.0.3:8083/axis-cgi/jpg/image.cgi
245 | http://192.168.0.3:8083/axis-cgi/mjpg/video.cgi?camera=2&fps=1&compression=80&resolution=320x240
246 | http://192.168.0.3:8083/axis-cgi/jpg/image.cgi?camera=3&compression=50&resolution=480x640
247 | http://pastebin.com/NCWWSQxa (matrix 2x2)
248 | ```
249 |
250 | ## Get Audio stream
251 | Access: admin
252 |
253 | GET `/axis-cgi/audio/receive.wav`
254 |
255 | is used to request a WAV audio stream with specified arguments.
256 | `http:///axis-cgi/audio/receive.wav[?=[&=...]]`
257 |
258 | Parameters:
259 | * `camera=` (optional) - select audio source. 1..n.
260 | * `cameraId` (optional) - camera ID
261 |
262 | Examples:
263 | ```
264 | http://192.168.0.3:8083/axis-cgi/audio/receive.wav
265 | http://192.168.0.3:8083/axis-cgi/audio/receive.wav?camera=2
266 | ```
267 |
268 | ## PTZ control
269 | Access: admin
270 |
271 | GET `/axis-cgi/com/ptz.cgi`
272 |
273 | Parameters:
274 | * `camera=` (optional) - select video source. 1..n.
275 | * `continuouspantiltmove=,` (optional) - continuous pan/tilt motion. Positive values mean right (pan) and up (tilt), negative values mean left (pan) and down (tilt). "0,0" means stop. Values as ,.
276 | * `continuouszoommove=` (optional) - continuous zoom motion. Positive values mean zoom in and negative values mean zoom out. "0" means stop.
277 | * `continuousfocusmmove=` (optional) - continuous focus motion. Positive values focus near and negative values mean focus far. "0" means stop.
278 | * `continuousirismmove=` (optional) - continuous iris motion. Positive values mean iris open and negative values mean iris close. "0" means stop.
279 | * `move=home` (optional) - moves home.
280 | * `gotoserverpresetno=` (optional) - move to the position associated with the specified preset position number. 1..n.
281 | * `setserverpresetno=` (optional) - save the current position with the specified preset position number. 1..n.
282 |
283 | Examples:
284 | ```
285 | http://192.168.0.3:8083/axis-cgi/com/ptz.cgi?move=home
286 | http://192.168.0.3:8083/axis-cgi/com/ptz.cgi?camera=2&gotoserverpresetno=3
287 | http://192.168.0.3:8083/axis-cgi/com/ptz.cgi?camera=2&setserverpresetno=2
288 | http://192.168.0.3:8083/axis-cgi/com/ptz.cgi?continuouspantiltmove=0,0
289 | http://192.168.0.3:8083/axis-cgi/com/ptz.cgi?continuouspantiltmove=100,-100&continuouszoommove=100
290 | ```
291 |
292 | ## LED control
293 | Access: admin
294 |
295 | GET `/axis-cgi/io/lightcontrol.cgi`
296 |
297 | Parameters:
298 | * `camera=` (optional) - select video source. 1..n.
299 | * `action=` (mandatory) - specifies light source and value. Action `L1:-100` - LED on, `L1:-0` - LED off, `L1:-50` - LED auto.
300 |
301 | Examples:
302 | ```
303 | http://192.168.0.3:8083/axis-cgi/io/lightcontrol.cgi?action=L1:-100
304 | http://192.168.0.3:8083/axis-cgi/io/lightcontrol.cgi?action=L1:-0
305 | http://192.168.0.3:8083/axis-cgi/io/lightcontrol.cgi?action=L1:-50
306 | ```
307 |
308 | ## Background mode
309 | Access: admin.
310 |
311 | The `root.BackgroundMode` parameter is used to switch on/off background mode in tinyCam Monitor.
312 |
313 | GET `/param.cgi?action=update&root.BackgroundMode=`
314 |
315 | Parameters:
316 | * `root.BackgroundMode=` (mandatory) - can be `on` or `off`.
317 |
318 |
319 | Examples:
320 | ```
321 | http://192.168.0.3:8083/param.cgi?action=update&root.BackgroundMode=on
322 | http://192.168.0.3:8083/param.cgi?action=update&root.BackgroundMode=off
323 | ```
324 |
325 | ## Stream profile
326 | Access: admin
327 |
328 | The `root.StreamProfile` parameter is used to change stream profile in tinyCam Monitor.
329 |
330 | GET `/param.cgi?action=update&root.StreamProfile=`
331 |
332 | Parameters:
333 | * `root.StreamProfile=` (mandatory) - can be `main`, `sub` or `auto`.
334 |
335 |
336 | Examples:
337 | ```
338 | http://192.168.0.3:8083/param.cgi?action=update&root.StreamProfile=main
339 | http://192.168.0.3:8083/param.cgi?action=update&root.StreamProfile=auto
340 | ```
341 |
342 | ## Notificaions
343 | Access: admin
344 |
345 | The `root.Notifications` parameter is used to switch on/off notifications in tinyCam Monitor.
346 |
347 | GET `/param.cgi?action=update&root.Notifications=[&tag=]`
348 |
349 | Parameters:
350 | * `root.Notifications=` (mandatory) - can be `on` or `off`.
351 | * `tag=` (optional) - tag name. If specified the app sends "Motion Detection On" or "Motion Detection Off" command to all cameras under the tag for changing on-camera motion detection.
352 |
353 |
354 | Examples:
355 | ```
356 | http://192.168.0.3:8083/param.cgi?action=update&root.Notifications=on
357 | http://192.168.0.3:8083/param.cgi?action=update&root.Notifications=on&tag=Office
358 | http://192.168.0.3:8083/param.cgi?action=update&root.Notifications=off
359 | http://192.168.0.3:8083/param.cgi?action=update&root.Notifications=off&tag=Home
360 | ```
361 |
362 | ## Power safe mode
363 | Access: admin only
364 |
365 | The `root.PowerSafeMode` parameter is used to switch on/off power safe mode in tinyCam Monitor.
366 |
367 | GET `/param.cgi?action=update&root.PowerSafeMode=`
368 |
369 | Parameters:
370 | * `root.PowerSafeMode=` (mandatory) - can be `on` or `off`.
371 |
372 |
373 | Examples:
374 | ```
375 | http://192.168.0.3:8083/param.cgi?action=update&root.PowerSafeMode=on
376 | http://192.168.0.3:8083/param.cgi?action=update&root.PowerSafeMode=off
377 | ```
378 |
379 | ## Delete file
380 | Access: admin
381 |
382 | `action=delete` with `root.Filename` parameter used to delete recorded MP4 or JPEG files in tinyCam Monitor.
383 |
384 | GET `/param.cgi?action=delete&root.Filename=`
385 |
386 | Parameters:
387 | * `root.Filename=` (mandatory) - filename.
388 |
389 | Examples:
390 | ```
391 | http://192.168.0.3:8083/param.cgi?action=delete&root.Filename=/IPV68P2P/2016-10-21%2010.03.33.mp4
392 | ```
393 |
394 | ## Pin file
395 | Access: admin
396 |
397 | `action=pin` with `root.Filename` parameter used to pin recorded MP4 or JPEG files in tinyCam Monitor.
398 |
399 | GET `/param.cgi?action=pin&root.Filename=`
400 |
401 | Parameters:
402 | * `root.Filename=` (mandatory) - filename.
403 |
404 | Examples:
405 | ```
406 | http://192.168.0.3:8083/param.cgi?action=pin&root.Filename=/IPV68P2P/2016-10-21%2010.03.33.mp4
407 | ```
408 |
409 | ## Unpin file
410 | Access: admin
411 |
412 | `action=unpin` with `root.Filename` parameter used to unpin recorded MP4 or JPEG files in tinyCam Monitor.
413 |
414 | GET `/param.cgi?action=unpin&root.Filename=`
415 |
416 | Parameters:
417 | * `root.Filename=` (mandatory) - filename.
418 |
419 | Examples:
420 | ```
421 | http://192.168.0.3:8083/param.cgi?action=unpin&root.Filename=/IPV68P2P/2016-10-21%2010.03.33_pin.mp4
422 | ```
423 |
424 | ## Reboot Android device
425 | Access: admin. Root required.
426 |
427 | GET `/axis-cgi/admin/restart.cgi`
428 |
429 | Examples:
430 | ```
431 | http://192.168.0.3:8083/axis-cgi/admin/restart.cgi
432 | ```
433 |
--------------------------------------------------------------------------------