alexeyvasilyev / tinycam-api

tinyCam app web server API documentation
https://tinycammonitor.com
28 stars 6 forks source link
tinycam

tinyCam app web server API

This is official documentation of the REST API provided by tinyCam Monitor PRO web server - Android app for video surveillance. 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.

Authentication

tinyCam supports three types of authentication:

1. Basic authentication (legacy)

Example:

https://admin:mypassword@192.168.0.3:8083/axis-cgi/mjpg/video.cgi

2. Providing credentials as parameters

GET parameters user=<string>&pwd=<string>

Use it when there is no way to use basic authentication (e.g. for home automation).

Example:

https://192.168.0.3:8083/axis-cgi/mjpg/video.cgi?user=admin&pwd=mypassword

3. Token based authentication (recommended to use)

Access: guest, admin

GET /api/v1/login?user=<string>&pwd=<string>

Example:

https://192.168.0.3:8083/api/v1/login?user=admin&pwd=mypassword

JSON payload:

{
    "data": {
        "token": "d6bdc406225bf6bb6ecf720e97e8927acfe52022",
        "access": "admin"
    }
}

For subsequent requests, add token with token value returned in the login response.

Example:

https://192.168.0.3:8083/axis-cgi/mjpg/video.cgi?token=d6bdc406225bf6bb6ecf720e97e8927acfe52022

Logout

Access: guest, admin

GET /api/v1/logout?token=<string>

Deletes authentication token.

Example:

https://192.168.0.3:8083/api/v1/logout?token=d6bdc406225bf6bb6ecf720e97e8927acfe52022

Get camera list

Access: guest, admin

GET /api/v1/get_cam_list?token=<string>

Example:

https://192.168.0.3:8083/api/v1/get_cam_list?token=d6bdc406225bf6bb6ecf720e97e8927acfe52022

JSON payload:

{
    "data": [{
        "name": "Front yard",
        "enabled": true,
        "id": 182399567,
        "ptzCapabilities": 230911,
        "audioListening": true,
        "cloudAccess": false
    }, {
        "name": "Doorbell",
        "enabled": true,
        "id": 1455317736,
        "ptzCapabilities": 32768,
        "audioListening": true,
        "cloudAccess": true
    }]
}

Get camera event list

Access: guest, admin

GET /api/v1/get_cam_event_list?token=<string>&cameraId=<number>&endtime=<number>&count=<number>&type=<string>&filter=<string>

List is returned in descending order (new events first).

Example:

 https://192.168.0.3/api/v1/get_cam_event_list?token=d6bdc406225bf6bb6ecf720e97e8927acfe52022&cameraId=182399567&endtime=1601381164000&count=15&type=local&filter=person

JSON payload:

{
    "data": [{
        "time": 1601381164000,
        "duration": 120000,
        "motion": "person",
        "video": "\/api\/v1\/get_file?file=\/Front%20yard\/2020-09-29%2015.06.04%20120sec%20person.mp4",
        "image": "\/api\/v1\/get_file?file=\/Front%20yard\/2020-09-29%2015.06.04%20120sec%20person.mp4.jpg"
    }, {
        "time": 1601380363000,
        "duration": 58000,
        "motion": "person",
        "video": "\/api\/v1\/get_file?file=\/Front%20yard\/2020-09-29%2014.52.43%2058sec%20person.mp4",
        "image": "\/api\/v1\/get_file?file=\/Front%20yard\/2020-09-29%2014.52.43%2058sec%20person.mp4.jpg"
    }, {
        "time": 1601379016000,
        "duration": 54000,
        "motion": "person",
        "video": "\/api\/v1\/get_file?file=\/Front%20yard\/2020-09-29%2014.30.16%2054sec%20person.mp4",
        "image": "\/api\/v1\/get_file?file=\/Front%20yard\/2020-09-29%2014.30.16%2054sec%20person.mp4.jpg"
    }]
}

Get file

GET /api/v1/get_file?token=<string>&file=<string>

Example:

https://192.168.0.3/api/v1/get_file?file=/Front%20yard/2020-09-29%2010.51.26%2043sec%20motion.mp4.jpg&token=d6bdc406225bf6bb6ecf720e97e8927acfe52022

Get status

Access: admin

GET /api/v1/get_status?token=<string>&cameraId=<number>

Example:

https://192.168.0.3/api/v1/get_status?token=d6bdc406225bf6bb6ecf720e97e8927acfe52022
https://192.168.0.3/api/v1/get_status?token=d6bdc406225bf6bb6ecf720e97e8927acfe52022&cameraId=182399567

Global JSON payload:

{
    "data": {
        "backgroundMode": true,
        "cpuUsagePercents": 0,
        "cpuFrequencyMhz": 2014,
        "temperature": -1,
        "memoryAvailable": 1089949696,
        "memoryUsed": 490082304,
        "threadsUsed": 73,
        "threadsRunnableUsed": 20,
        "processes": [{
            "name": "UI",
            "memoryUsed": 38047744
        }, {
            "name": "Watchdog",
            "memoryUsed": 29640704
        }, {
            "name": "WebServer",
            "memoryUsed": 231104512
        }, {
            "name": "Background",
            "memoryUsed": 193558528
        }],
        "batteryLevel": 100,
        "batteryStatus": "charging",
        "uptime": 23160200,
        "networkInBps": 76103,
        "networkOutBps": 0,
        "streamProfile": 0,
        "powerSafeMode": false,
        "notifications": true,
        "rootAvailable": false,
        "spaceUsed": 4094579744,
        "spaceAvailable": 1849597952,
        "liveConnections": 1,
        "motionCameras": ["Front yard"]
    }
}

Camera JSON payload:

{
    "data": {
        "motion": true
    }
}

Get MJPEG and JPEG video streams

Access: guest, admin

GET /axis-cgi/mjpg/video.cgi

Used to request a Motion JPEG video stream with specified arguments.

GET /axis-cgi/jpg/image.cgi

Request for single JPEG.

http://<servername>/axis-cgi/mjpg/video.cgi[?<argument>=<value>[&<argument>=<value>...]]
http://<servername>/axis-cgi/jpg/image.cgi[?<argument>=<value>[&<argument>=<value>...]]

Parameters:

Examples:

http://192.168.0.3:8083/axis-cgi/mjpg/video.cgi
http://192.168.0.3:8083/axis-cgi/jpg/image.cgi
http://192.168.0.3:8083/axis-cgi/mjpg/video.cgi?camera=2&fps=1&compression=80&resolution=320x240
http://192.168.0.3:8083/axis-cgi/jpg/image.cgi?camera=3&compression=50&resolution=480x640
http://pastebin.com/NCWWSQxa (matrix 2x2)

Get Audio stream

Access: admin

GET /axis-cgi/audio/receive.wav

is used to request a WAV audio stream with specified arguments. http://<servername>/axis-cgi/audio/receive.wav[?<argument>=<value>[&<argument>=<value>...]]

Parameters:

Examples:

http://192.168.0.3:8083/axis-cgi/audio/receive.wav
http://192.168.0.3:8083/axis-cgi/audio/receive.wav?camera=2

PTZ control

Access: admin

GET /axis-cgi/com/ptz.cgi

Parameters:

Examples:

http://192.168.0.3:8083/axis-cgi/com/ptz.cgi?move=home
http://192.168.0.3:8083/axis-cgi/com/ptz.cgi?camera=2&gotoserverpresetno=3
http://192.168.0.3:8083/axis-cgi/com/ptz.cgi?camera=2&setserverpresetno=2
http://192.168.0.3:8083/axis-cgi/com/ptz.cgi?continuouspantiltmove=0,0
http://192.168.0.3:8083/axis-cgi/com/ptz.cgi?continuouspantiltmove=100,-100&continuouszoommove=100

LED control

Access: admin

GET /axis-cgi/io/lightcontrol.cgi

Parameters:

Examples:

http://192.168.0.3:8083/axis-cgi/io/lightcontrol.cgi?action=L1:-100
http://192.168.0.3:8083/axis-cgi/io/lightcontrol.cgi?action=L1:-0
http://192.168.0.3:8083/axis-cgi/io/lightcontrol.cgi?action=L1:-50

Background mode

Access: admin.

The root.BackgroundMode parameter is used to switch on/off background mode in tinyCam Monitor.

GET /param.cgi?action=update&root.BackgroundMode=<string>

Parameters:

Examples:

http://192.168.0.3:8083/param.cgi?action=update&root.BackgroundMode=on
http://192.168.0.3:8083/param.cgi?action=update&root.BackgroundMode=off

Stream profile

Access: admin

The root.StreamProfile parameter is used to change stream profile in tinyCam Monitor.

GET /param.cgi?action=update&root.StreamProfile=<string>

Parameters:

Examples:

http://192.168.0.3:8083/param.cgi?action=update&root.StreamProfile=main
http://192.168.0.3:8083/param.cgi?action=update&root.StreamProfile=auto

Notificaions

Access: admin

The root.Notifications parameter is used to switch on/off notifications in tinyCam Monitor.

GET /param.cgi?action=update&root.Notifications=<string>[&tag=<string>]

Parameters:

Examples:

http://192.168.0.3:8083/param.cgi?action=update&root.Notifications=on
http://192.168.0.3:8083/param.cgi?action=update&root.Notifications=on&tag=Office
http://192.168.0.3:8083/param.cgi?action=update&root.Notifications=off
http://192.168.0.3:8083/param.cgi?action=update&root.Notifications=off&tag=Home

Power safe mode

Access: admin only

The root.PowerSafeMode parameter is used to switch on/off power safe mode in tinyCam Monitor.

GET /param.cgi?action=update&root.PowerSafeMode=<string>

Parameters:

Examples:

http://192.168.0.3:8083/param.cgi?action=update&root.PowerSafeMode=on
http://192.168.0.3:8083/param.cgi?action=update&root.PowerSafeMode=off

Delete file

Access: admin

action=delete with root.Filename parameter used to delete recorded MP4 or JPEG files in tinyCam Monitor.

GET /param.cgi?action=delete&root.Filename=<string>

Parameters:

Examples:

http://192.168.0.3:8083/param.cgi?action=delete&root.Filename=/IPV68P2P/2016-10-21%2010.03.33.mp4

Pin file

Access: admin

action=pin with root.Filename parameter used to pin recorded MP4 or JPEG files in tinyCam Monitor.

GET /param.cgi?action=pin&root.Filename=<string>

Parameters:

Examples:

http://192.168.0.3:8083/param.cgi?action=pin&root.Filename=/IPV68P2P/2016-10-21%2010.03.33.mp4

Unpin file

Access: admin

action=unpin with root.Filename parameter used to unpin recorded MP4 or JPEG files in tinyCam Monitor.

GET /param.cgi?action=unpin&root.Filename=<string>

Parameters:

Examples:

http://192.168.0.3:8083/param.cgi?action=unpin&root.Filename=/IPV68P2P/2016-10-21%2010.03.33_pin.mp4

Reboot Android device

Access: admin. Root required.

GET /axis-cgi/admin/restart.cgi

Examples:

http://192.168.0.3:8083/axis-cgi/admin/restart.cgi