Skip to main content
Skip table of contents

Archive generation

When generating an archive, a record will be created in the history and returned in the response. Everything happens asynchronously.

Afterward, the VMS downloads the archive to its server and sends a push notification via a WebSocket with a download link.

The archive is deleted from the disk if it has been there for more than 3 hours. The deletion process is triggered by a cron job every 10 minutes.

To regenerate the archive, see Regeneration of the archive

POST/api/v1/downloads

Headers

Authorization

Bearer token

Accept

application/json

X-Client

ios-cctv|android-cctv|thick-legal|web

X-UUID

unique device id

Body

json

JSON
{
    "from": "2023-03-10T10:20:00Z",
    "to": "2023-03-10T10:25:00Z",
    "ids": [
        2
    ]
}

fromrequired

date

The date from which the archive is needed

torequired

date

The date until which the archive is needed.

idsrequired

array

The IDs of the cameras for which the archive will be generated

Response

200

Successful response

JSON
[
                {
                    "id": 6439,
                    "name": "Cameras",
                    "type": "mp4",
                    "url": "http://127.0.0.1:8080/storage/",
                    "from": "2023-03-10 10:20:00",
                    "to": "2023-03-10 10:25:00",
                    "created_at": "2023-03-10T11:58:41.000000Z",
                    "updated_at": "2023-03-10T11:58:41.000000Z",
                    "is_file_exists": true,
                    "user_id": 7
                }
            ]
401

Authorization token not provided or invalid

422

Returns a JSON object with an error, see Validation

JSON
{
    "message": "There won't be any informative message here",
    "errors": {
        "any_key": [
            "Here the error cause will be described"
        ]
    }
}

Example

JSON
curl -k --location --request POST 'https://vms.local/api/v1/downloads' \
--header 'Authorization:Bearer token' \
--header 'Accept:application/json' \
--header 'X-Client:ios-cctv|android-cctv|thick-legal|web' \
--header 'X-UUID:unique device id' \
--header 'Content-Type: application/json \
--data-raw '{
    "from": "2023-03-10T10:20:00Z",
    "to": "2023-03-10T10:25:00Z",
    "ids": [
        2
    ]
}'
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.