Skip to content

Latest commit

 

History

24 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Video API

The REST API allows you to make an operation on a video form data. API link: https://hng5.akinlua.repl.co/

Table of Contents

  1. Introduction
  2. Examples
  3. Error Responses

Introduction

The Video API provides a RESTful interface that allows a post request of a video form data and then stores the video in a disk and sends a response containing neccesary informations about the video inlcuding the video src path that can be used in the front end to display the video

Examples

Here are some examples on how to use the API:

You can use any application such as Postman to make the requests

Post A Video

POST /api/upload

Content-Type: multipart/form-data

Fields

| Field Name | Type | Description | ---------- | ------ | | chunk | file | Get the chunk from file.slice(start, start + chunksize) | totalSize| number | Get the file size from file.size | start | number | Get the value from which the file is sliced, initial 0 | fileName | String | Get the filename from file.name | fileType | Mimetype| Get the mimetype of the file from file.type

Response

.Response:

{
"error": false,
"status": 200,
"Message": "File Uploaded Successfully",
"originalname": "vlc-record-2022-08-13-22h48m54s-Superstore S03E03 - RMTeam, RMZ.cr-.mp4",
"filename": "Video_1696060225889-vlc-record-2022-08-13-22h48m54s-Superstore S03E03 - RMTeam, RMZ.cr-.mp4",
"Path": "public/upload/Video_1696060225889-vlc-record-2022-08-13-22h48m54s-Superstore S03E03 - RMTeam, RMZ.cr-.mp4",
"videoPath_src": "https://hng5.akinlua.repl.co//upload/Video_1696060225889-vlc-record-2022-08-13-22h48m54s-Superstore S03E03 - RMTeam, RMZ.cr-.mp4",
"transcription": "words of transcript"
}

Error Responses

HTTP Status: 404 Not Found

Content-Type: application/json

If a file is not found

. Body:

{
    error: true,
    status: 404,
    errorMessage: "No File Found"
}

HTTP Status: 400 Bad Request

Content-Type: application/json

If the file found is not a video file Only .mp4 is allowed.

. Body:

{
    error: true,
    status: 400,
    errorMessage: "Make sure file is a video file"
}

If the video file is more than 50Mb which is the max size allowed for processing the video.

. Body:

{
    error: true,
    status: 400,
    errorMessage: "Make sure Video file is no more than 50MB"
}

HTTP Status: 500 Internal Server Error

Content-Type: application/json

If there was any other error with the server, you will get the below error

.Body:

{
    error: true,
    status: 500,
    errorMessage: "An error was found"
}

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages