Transferring Archived Files
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
import requests
url = "https://api.cxxx.eagleeyenetworks.com/api/v3.0/files/2c236d24-79e3-44d5-adeb-4d370221217d:download"
headers = {"accept": "application/octet-stream"}
response = requests.get(url, headers=headers)
print(response.text)
using RestSharp;
var options = new RestClientOptions("https://api.cxxx.eagleeyenetworks.com/api/v3.0/files/2c236d24-79e3-44d5-adeb-4d370221217d:download");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("accept", "application/octet-stream");
var response = await client.GetAsync(request);
Console.WriteLine("{0}", response.Content);
const url = 'https://api.cxxx.eagleeyenetworks.com/api/v3.0/files/2c236d24-79e3-44d5-adeb-4d370221217d:download';
const options = {method: 'GET', headers: {accept: 'application/octet-stream'}};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));
If you run the above request by CURL, the media file is downloaded to the <local-path>
with .mp4
extension.
This is not for Video Playback
The download feature is provided for long term storage of video files outside of the Eagle Eye Networks VMS and is not meant to be used for regular playback of recorded video. For instructions on how to access previously recorded video footage, see the guide for Viewing Recorded Video and Audio.
Missuse of the download feature could lead to rate limiting of your API usage.
Uploading a File
Uploading a file to the archive storage is a multi-step process. To start, you need to make a POST
request to the /files endpoint. In the request body, you'll need to include the name of the file with the file extension included. Optionally, you can include the directory
parameter to specify the folder where the file will be uploaded or the mimeType
parameter to explicitly specify the type of the file.
curl --request POST \
--url https://api.cxxx.eagleeyenetworks.com/api/v3.0/files \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"mimeType": "video/mp4",
"directory": "/uploads",
"name": "Video CAM 1 2023-05-22 15-10-39.mp4"
}
'
import requests
url = "https://api.cxxx.eagleeyenetworks.com/api/v3.0/files?name=Video%20CAM%201%202023-05-22%2015-10-39.mp4&directory=%2Fuploads&mimeType=video%2Fmp4"
headers = {
"accept": "application/json",
"content-type": "application/octet-stream"
}
response = requests.post(url, headers=headers)
print(response.text)
using RestSharp;
var options = new RestClientOptions("https://api.cxxx.eagleeyenetworks.com/api/v3.0/files?name=Video%20CAM%201%202023-05-22%2015-10-39.mp4&directory=%2Fuploads&mimeType=video%2Fmp4");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("accept", "application/json");
request.AddHeader("content-type", "application/octet-stream");
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
const url = 'https://api.cxxx.eagleeyenetworks.com/api/v3.0/files?name=Video%20CAM%201%202023-05-22%2015-10-39.mp4&directory=%2Fuploads&mimeType=video%2Fmp4';
const options = {
method: 'POST',
headers: {accept: 'application/json', 'content-type': 'application/octet-stream'}
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));
If successful, the response to the above will include the id
of the newly created file. You can then use this id
to find the uploadUrl
of the file by sending a request to the /files/{file_id} endpoint. You'll need to set the include
parameter to uploadUrl
in the request.
curl --request GET \
--url 'https://api.cxxx.eagleeyenetworks.com/api/v3.0/files/36230c7b-f827-49b8-a76a-d8620f899dae?include=uploadUrl' \
--header 'accept: application/json'
import requests
url = "https://api.cxxx.eagleeyenetworks.com/api/v3.0/files/36230c7b-f827-49b8-a76a-d8620f899dae"
headers = {"accept": "application/json"}
response = requests.get(url, headers=headers)
print(response.text)
using RestSharp;
var options = new RestClientOptions("https://api.cxxx.eagleeyenetworks.com/api/v3.0/files/36230c7b-f827-49b8-a76a-d8620f899dae");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("accept", "application/json");
var response = await client.GetAsync(request);
Console.WriteLine("{0}", response.Content);
const url = 'https://api.cxxx.eagleeyenetworks.com/api/v3.0/files/36230c7b-f827-49b8-a76a-d8620f899dae';
const options = {method: 'GET', headers: {accept: 'application/json'}};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));
Once you have the uploadUrl
, you can use it to upload the file to the archive storage.
curl --upload-file 'Video CAM 1 2023-05-22 15-10-39.mp4' 'https://een-drivefs-c025.s3.amazonaws.com/....'
Updated 1 day ago