# Requests


# List cameras

Returns an array of registered camera objects

# Parameters:

Name Type Description Required
token String user's Monuv token
p String live url stream format (set to p=hls for Apple HLS)

# Response Main Fields:

Name Type Description
id String camera id
description String camera's description
status String camera's status description (ONLINE, OFFLINE, ERRO PERMANENTE, etc.)
live_url String live video url (this url should be given to the video player)
server_url String url of the server which the camera is connected
thumb_url String url to the camera's last thumbnail
digest String digest for camera API requests
hash String hash for camera video requests
client_id String camera's client id
address String camera's address
latitude String camera's latitude
longitude String camera's longitude
recording_error Boolean Informs if the camera recording has any errors
[
    {
        "id": "0000",
        "description": "Teste IA#0000",
        "status": "OFFLINE",
        "live_url": "LIVE_URL",
        "server_url": "",
        "thumb_url": "THUMB_URL",
        "digest": "DIGEST",
        "hash": "HASH",
        "client_id": "CLIENT_ID",
        "address": "ADRESS",
        "latitude": "LAT",
        "longitude": "LON",
    }
]

# Code example

curl --location 'https://app.monuv.com.br/api/cameras?token=USER_TOKEN'
const axios = require('axios');
const FormData = require('form-data');
let data = new FormData();

let config = {
		method: 'get',
		maxBodyLength: Infinity,
		url: 'https://app.monuv.com.br/api/cameras?token=USER_TOKEN',
};

axios.request(config)
.then((response) => {
		console.log(JSON.stringify(response.data));
})
.catch((error) => {
		console.log(error);
});
import requests

url = "https://app.monuv.com.br/api/cameras?token=USER_TOKEN"

response = requests.request("GET", url)

print(response.text)

# Get camera

Returns a registered camera object

# Parameters:

Name Type Description Required
token String user's Monuv token

# Response Main Fields:

Name Type Description
id String camera id
description String camera's description
status String camera's status description (ONLINE, OFFLINE, ERRO PERMANENTE, etc.)
live_url String live video url (this url should be given to the video player)
server_url String url of the server which the camera is connected
thumb_url String url to the camera's last thumbnail
digest String digest for camera API requests
hash String hash for camera video requests
client_id String camera's client id
address String camera's address
latitude String camera's latitude
longitude String camera's longitude
recording_error Boolean Informs if the camera recording has any errors
{
    "id": "0000",
    "description": "Teste IA#0000",
    "status": "OFFLINE",
    "live_url": "LIVE_URL",
    "server_url": "",
    "thumb_url": "THUMB_URL",
    "digest": "DIGEST",
    "hash": "HASH",
    "client_id": "CLIENT_ID",
    "address": "ADRESS",
    "latitude": "LAT",
    "longitude": "LON",
}

# Code example

curl --location 'https://app.monuv.com.br/api/camera-player/1001?token=USER_TOKEN'
const axios = require('axios');
const FormData = require('form-data');
let data = new FormData();

let config = {
		method: 'get',
		maxBodyLength: Infinity,
		url: 'https://app.monuv.com.br/api/camera-player/1001?token=USER_TOKEN',
};

axios.request(config)
.then((response) => {
		console.log(JSON.stringify(response.data));
})
.catch((error) => {
		console.log(error);
});
import requests

url = "https://app.monuv.com.br/api/camera-player/1001?token=USER_TOKEN"

response = requests.request("GET", url)

print(response.text)

# Get camera player

Returns HTML with the camera's video player

# Parameters:

Name Type Description Required
token String user's Monuv token
id Integer camera id
footer Boolean Video timeline visibility
0 = Hidden
1 = Visible
controls Boolean Video controls visibility
0 = Hidden
1 = Visible
ts Integer Unix timestamp (seconds) to set recording player start (0 for live stream)
delay Integer delay in seconds to how further back the player will start from the given timestamp
timeline_interval Integer Timeline range that will be displayed (Default 24 hours)
10 = 10 minutes
1 = 1 hour
24 = 24 hour
video_speed String Speed ​​at which recorded video will be displayed (Default 1x)
options: 0.5, 1, 2, 4, 8, 16

# Response:

'<!DOCTYPE html>\n<html lang="pt-br" style=\'height:100%\'>\n<head>\n\n (...)

# Code example

curl --location 'https://app.monuv.com.br/api/camera/0000/player?token=USER_TOKEN'
const axios = require('axios');
const FormData = require('form-data');
let data = new FormData();

let config = {
		method: 'get',
		maxBodyLength: Infinity,
		url: 'https://app.monuv.com.br/api/camera/0000/player?token=USER_TOKEN',
};

axios.request(config)
.then((response) => {
		console.log(JSON.stringify(response.data));
})
.catch((error) => {
		console.log(error);
});
import requests

url = 'https://app.monuv.com.br/api/camera/0000/player?token=USER_TOKEN'

response = requests.request("GET", url)

print(response.text)

# Get recordings

Returns an array of jsons of stored recordings

# Parameters:

Name Type Description Required
token String user's Monuv token
id Integer camera id
digest String camera digest obtained from camera listing
timeStamp Integer Unix timestamp (miliseconds) to set first time recording
p String live url stream format (set to p=hls for Apple HLS)

# Response:

Name Type Description
CODE String return code (0 for success, 1 for error)
MSG String in case of error, related error message
DATA Array array of jsons describing the recordings
# Data:
Name Type Description
ini String Unix timestamp (miliseconds) of first recording
start_date String timestamp of first recording (YYYY-MM-DD HH:ii:ss)
dur String video duration in ms
file String video file name
url String video url (to be give to the video player)
{   "DATA":
        [{ "ini":1679324828000,
           "start_date":"2023-03-20 12:07:08",
           "dur":62000,
           "file":"VIDEO.mp4",
           "url":"VIDEO_URL"},
           (...)
        ]
}

# Code example

curl --location 'https://app.monuv.com.br/cameras/0000/recordings/?token=USER_TOKEN&digest=CAMERA_DIGEST'
const axios = require('axios');
const FormData = require('form-data');
let data = new FormData();

let config = {
		method: 'get',
		maxBodyLength: Infinity,
		url: 'https://app.monuv.com.br/cameras/0000/recordings/?token=USER_TOKEN&digest=CAMERA_DIGEST',
};

axios.request(config)
.then((response) => {
		console.log(JSON.stringify(response.data));
})
.catch((error) => {
		console.log(error);
});
import requests

url = 'https://app.monuv.com.br/cameras/0000/recordings/?token=USER_TOKEN&digest=CAMERA_DIGEST'

response = requests.request("GET", url)

print(response.text)

# Get hourly images

Returns an array of jsons of stored hourly generated captures

# Parameters:

Name Type Description Required
token String user's Monuv token
id Integer camera id
digest String camera digest obtained from camera listing
ts Integer Unix timestamp (seconds) to set first time recording

# Response:

[
    {
        "ts": 1648782000,
        "url": "THUMB_URL"
    },
           (...)
]

# Code example

curl --location 'https://app.monuv.com.br/api/camera/0000/thumbs-hourly?ts=1648844377&token=USER_TOKEN&digest=CAMERA_DIGEST'
const axios = require('axios');
const FormData = require('form-data');
let data = new FormData();

let config = {
		method: 'get',
		maxBodyLength: Infinity,
		url: 'https://app.monuv.com.br/api/camera/0000/thumbs-hourly?ts=1648844377&token=USER_TOKEN&digest=CAMERA_DIGEST',
};

axios.request(config)
.then((response) => {
		console.log(JSON.stringify(response.data));
})
.catch((error) => {
		console.log(error);
});
import requests

url = 'https://app.monuv.com.br/api/camera/0000/thumbs-hourly?ts=1648844377&token=USER_TOKEN&digest=CAMERA_DIGEST'

response = requests.request("GET", url)

print(response.text)

# Get minute-by-minute images

Returns an array of jsons of stored generated captures minute-by-minute

# Parameters:

Name Type Description Required
token String user's Monuv token
id Integer camera id
digest String camera digest obtained from camera listing
ts Integer Unix timestamp (seconds) to set first time recording

# Response:

[
    {
        "ts": 1648782000,
        "url": "THUMB_URL"
    },
           (...)
]

# Code example

curl --location 'https://app.monuv.com.br/api/camera/0000/thumbs-minutes?ts=1648844377&token=USER_TOKEN&digest=CAMERA_DIGEST'
const axios = require('axios');
const FormData = require('form-data');
let data = new FormData();

let config = {
		method: 'get',
		maxBodyLength: Infinity,
		url: 'https://app.monuv.com.br/api/camera/0000/thumbs-minutes?ts=1648844377&token=USER_TOKEN&digest=CAMERA_DIGEST',
};

axios.request(config)
.then((response) => {
		console.log(JSON.stringify(response.data));
})
.catch((error) => {
		console.log(error);
});
import requests

url = 'https://app.monuv.com.br/api/camera/0000/thumbs-minutes?ts=1648844377&token=USER_TOKEN&digest=CAMERA_DIGEST'

response = requests.request("GET", url)

print(response.text)

# Get camera live stream url

Returns camera live stream url

# Parameters:

Name Type Description Required
token String user's Monuv token
id Integer camera id

# Response:

Name Type Description
code String return code (0 for success, 1 for error)
msg String in case of error, related error message
data String live stream url
{
    "code": 0,
    "msg": "",
    "data": "LIVE_STREAM_URL"
}

# Code example

curl --location 'https://app.monuv.com.br/api/cameras/0000/live-url/?token=USER_TOKEN'
const axios = require('axios');
const FormData = require('form-data');
let data = new FormData();

let config = {
		method: 'get',
		maxBodyLength: Infinity,
		url: 'https://app.monuv.com.br/api/cameras/0000/live-url/?token=USER_TOKEN',
};

axios.request(config)
.then((response) => {
		console.log(JSON.stringify(response.data));
})
.catch((error) => {
		console.log(error);
});
import requests

url = 'https://app.monuv.com.br/api/cameras/0000/live-url/?token=USER_TOKEN'

response = requests.request("GET", url)

print(response.text)

# Create downloadable video

Generates a continuos video evidence set between given timestamps

# Parameters:

Name Type Description Required
token String user's Monuv token
camera_id Integer camera id
start_at Integer Unix timestamp (miliseconds) of video start
end_at Integer Unix timestamp (miliseconds) of video end
description String add a description to video

# Response:

Name Type Description
code String return code (0 for success, 1 for error)
msg String in case of error, related error message
data Array array of jsons describing the requested video generation
# Data:
Name Type Description
camera_id Integer camera id
description String video description
start_date String video start date (YYYY-MM-DD HH:MM:SS)
end_date String video end date (YYYY-MM-DD HH:MM:SS)
create_user_id Integer user id that created the video
update_user_id Integer user id that updated the video
status Integer 0 - under creation, 1 - success, 2 - erro generating video
updated_at String date of update
created_at String date of creation
id Integer downloadable video id
camera_name String camera name
last_thumb String url to the camera's last thumbnail
StartDateF String video start formated date (DD/MM/YYYY HH:MM)
EndDateF String video end formated date (DD/MM/YYYY HH:MM)
UrlDrive String downloadable video url
video_thumb String url to the generated video thumbnail
{
    "code": 0,
    "msg": "Vídeo sendo gerado. Para acompanhar os vídeos salvos, acesse a lista de vídeos salvos.",
    "video_thumb": "https://drives.staging.monuv.com.br/0000/ID.jpg"
    "data": {
        "camera_id": 0000,
        "description": "DESC",
        "start_date": "2023-03-20 12:07:08",
        "end_date": "2023-03-20 12:11:14",
        "create_user_id": "USER_ID",
        "update_user_id": "USER_ID",
        "status": 0,
        "updated_at": "2023-04-05 18:00:17",
        "created_at": "2023-04-05 18:00:17",
        "id": "ID",
        "camera_name": "CAMERA_NAME",
        "last_thumb": "LAST_THUMB_URL",
        "StartDateF": "20/03/2023 12:07",
        "EndDateF": "20/03/2023 12:11",
        "UrlDrive": "https://drives.monuv.com.br/0000/"
    }
}

# Code example

curl --location --request POST 'https://app.monuv.com.br/v2/api/drives?token=USER_TOKEN&camera_id=0000&start_at=1679324828000&end_at=1679325074000&description=DESC
const axios = require('axios');

let config = {
		method: 'post',
		maxBodyLength: Infinity,
		url: 'https://app.monuv.com.br/v2/api/drives?token=USER_TOKEN&camera_id=0000&start_at=1679324828000&end_at=1679325074000&description=DESC',
};

axios.request(config)
.then((response) => {
		console.log(JSON.stringify(response.data));
})
.catch((error) => {
		console.log(error);
});
import requests

url = "https://app.monuv.com.br/v2/api/drives?token=USER_TOKEN&camera_id=0000&start_at=1679324828000&end_at=1679325074000&description=DESC"

response = requests.request("POST", url)

print(response.text)

# List downloadable videos

List generated downloadable videos

# Parameters:

Name Type Description Required
token String user's Monuv token
ids Integer downloadable videos ids (The ids must be separated by a comma, e.g.: 1001,1002)

# Response:

Name Type Description
code String return code (0 for success, 1 for error)
msg String in case of error, related error message
data Array array of jsons describing the requested video generation
# Data:
Name Type Description
id Integer downloadable video id
description String video description
url String generated video url
startDateF String video start date (YYYY-MM-DD HH:MM:SS)
endDateF String video end date (YYYY-MM-DD HH:MM:SS)
tsStart Integer Unix timestamp (miliseconds) of video start
tsEnd Integer Unix timestamp (miliseconds) of video end
camera_name String camera name
status Integer 0 = under creation, 1 = success, 2 = error generating video
last_thumb String url to the camera's last thumbnail
video_thumb String url to the generated video thumbnail
{
    "code": 0,
    "msg": "",
    "data": [
        {
            "id": 0000,
            "description": "cool",
            "url": "https://drives.monuv.com.br/00000/642de16230789",
            "startDateF": "20/03/2023 12:07",
            "endDateF": "20/03/2023 12:11",
            "tsStart": 1679324828,
            "tsEnd": 1679325074,
            "camera_name": "CAMERA_NAME",
            "status": 1,
            "last_thumb": "LAST_THUMB_URL",
            "video_thumb": "VIDEO_THUMB_URL"
        }
    ]
}

# Code example

curl --location 'https://app.monuv.com.br/v2/api/drives?token=USER_TOKEN'
const axios = require('axios');

let config = {
		method: 'get',
		maxBodyLength: Infinity,
		url: 'https://app.monuv.com.br/v2/api/drives?token=USER_TOKEN',
};

axios.request(config)
.then((response) => {
		console.log(JSON.stringify(response.data));
})
.catch((error) => {
		console.log(error);
});
import requests

url = "https://app.monuv.com.br/v2/api/drives?token=USER_TOKEN"

response = requests.request("GET", url)

print(response.text)

# Remove downloadable video

Remove generated downloadable video

# Parameters:

Name Type Description Required
token String user's Monuv token
id Integer generated video id

# Response:

Name Type Description
code String return code (0 for success, 1 for error)
msg String in case of error, related error message
{
    "code": 0,
    "msg": "Vídeo excluído com sucesso.",
    "data": []
}

# Code example

curl --location --request POST 'https://app.monuv.com.br/v2/api/drives/delete/0000?token=USER_TOKEN'
const axios = require('axios');

let config = {
		method: 'post',
		maxBodyLength: Infinity,
		url: 'https://app.monuv.com.br/v2/api/drives/delete/0000?token=USER_TOKEN',
};

axios.request(config)
.then((response) => {
		console.log(JSON.stringify(response.data));
})
.catch((error) => {
		console.log(error);
});
import requests

url = 'https://app.monuv.com.br/v2/api/drives/delete/0000?token=USER_TOKEN'

response = requests.request("POST", url)

print(response.text)