Introduction

Eagle Eye Networks users can archive part of their recorded videos in the archive storage associated with their account. Archived videos are protected from being overwritten by the system according to the retention time configuration. Using the /files API, you can access a list of archived files, and, if necessary, rename, move, and delete them.

Before you begin

  • Login to your account and receive an access token.
  • Get our Base URL from here

Procedure

Getting a list of the archived files

By calling the GET /files endpoint you can retrieve a list of the available files and folders in the archive storage.

curl --location 'https://<base-URL>/api/v3.0/files' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <access-token>'

The response to the above request is the following:

{
    "nextPageToken": "",
    "prevPageToken": "",
    "results": [
        {
            "id": "4272a107-a9f1-4f45-bc95-3882a285205c",
            "mimeType": "application/directory",
            "directory": "/",
            "name": "Test"
        },
        {
            "id": "36230c7b-f827-49b8-a76a-d8620f899dae",
            "mimeType": "video/mp4",
            "directory": "/",
            "name": "Video CAM 1 2023-05-22 15-10-39.mp4"
        },
        {
            "id": "2c236d24-79e3-44d5-adeb-4d370221217d",
            "mimeType": "video/mp4",
            "directory": "/Test",
            "name": "Video CAM 1 2023-05-22 15-10-39.mp4"
        }
    ]
}

By using the /files/{id} endpoint it is possible to get detailed information about a specific ID.

curl --location '<base-URL>/api/v3.0/files/<ID>?include=publicShare&include=createTimestamp' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <access-token>'

πŸ“˜

Note

You can retrieve more information about a file by including different parameters. To maximize the performance and minimize the response time, it is recommended to limit the parameters you include.

Deleting a file

To delete a file or folder make a DELETE call to the /files/{id} endpoint:

curl --location --request DELETE 'https://<base-URL>/api/v3.0/files/<ID>' \
--header 'Authorization: Bearer <access-token>'

Downloading a file

To download a file add the alt=media parameters to the /files/{id} endpoint as shown below:

curl --location 'https://<base_URL>/api/v3.0/files/<ID>?alt=media' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <access-token>'
--output <local-path>\<file-name>.mp4

If you run the above request by CURL, the media file is downloaded to the <local-path> with .mp4 extension.

Renaming and moving a file or a folder

The following example of a PUT request shows how to rename/move a file or folder. You need to make a PUT request with the detailed /files/<ID> endpoint for this purpose.

curl --location --request PUT 'https://<base_URL>/api/v3.0/files/36230c7b-f827-49b8-a76a-d8620f899dae' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <access-token>' \
--data '{
    "id": "f2d4ad7b-bada-4c44-9f70-9c4b85e46b7d",
    "mimeType": "video/mp4",
    "directory": "/test folder5",
    "name": "Video CAM 1 2023-06-01 14-37-13.mp4"
}'

As shown above, you can change the name of a file or folder. You can also use the same name, but a different directory value to move the file or folder. If the directory does not exist, it is automatically created and the move operation is performed.

πŸ“˜

Note

The history browser of the VMS allows users to save video files to the archive folder. Directly uploading or creating video files from the API is not possible at the moment.