Skip to main content

Uploading videos

Getting started

In order to send vidoes to the Upload API, you can do so by sending a POST request to the https://api.fivemanage.com/api/v3/file endpoint. To upload video, simply submit a form with a form field called file with your video as value. As well as metadata.

Uploading a video

const axios = require('axios');
const fs = require('fs');

const apiKey = 'YOUR_API_TOKEN';
const url = 'https://api.fivemanage.com/api/v3/file';

const formData = new FormData();

formData.append('file', yourVideoBlob);
// Optional metadata field (JSON string)
formData.append("metadata", JSON.stringify({
    name: 'My video',
    description: 'This is a video of something cool",
    // or any other field
}));

axios.post(url, formData, {
    headers: {
        Authorization: apiKey,
    }
}).then(res => {
    console.log(res.data.url);
}).catch(err => {
    console.error(err);
});

Response

Success
{
  "data": {
    "id": "7F9pGhN8qwErT1vx5aZk",
    "url": "https://r2.fivemanage.com/6E9pGhN8qwErT1vx5aZk/7F9pGhN8qwErT1vx5aZk.mp4"
  },
  "status": "ok"
}

Deleting a video

When we want to delete a video, we can do so by sending a DELETE request to the https://api.fivemanage.com/api/v3/file/:path endpoint. The :id parameter should be the ID of the video you want to delete. You can get the ID from the response when you upload a video (see above).
import axios from "axios";

const options = {
  method: 'DELETE',
  url: 'http://api.fivemanage.com/api/v3/file/0987654321',
  headers: {
    Authorization: 'YOUR_API_TOKEN'
  }
};

axios.request(options).then(function (response) {
  console.log(response.data);
}).catch(function (error) {
  console.error(error);
})

Listing videos

You can list your uploaded videos using a GET request. You can filter by type to only see videos.
const axios = require('axios');

const apiKey = 'YOUR_API_TOKEN';
// Filter by type=video
const url = 'https://api.fivemanage.com/api/v3/file?type=video';

axios.get(url, {
    headers: { Authorization: apiKey }
}).then(res => {
    console.log(res.data);
}).catch(err => {
    console.error(err);
});

Getting video details

To get details about a specific video, including its metadata, use the GET request with the file ID.
const axios = require('axios');

const apiKey = 'YOUR_API_TOKEN';
const fileId = '7F9pGhN8qwErT1vx5aZk';
const url = `https://api.fivemanage.com/api/v3/file/${fileId}`;

axios.get(url, {
    headers: { Authorization: apiKey }
}).then(res => {
    console.log(res.data);
}).catch(err => {
    console.error(err);
});