The URL for the API is https://brainflixback-f347c94ccf8f.herokuapp.com/
To register with the API and get a key, make a GET request to /register
. You can do this with the browser and you only need to do it once. Store the key in a global variable in your website.
GET https://brainflixback-f347c94ccf8f.herokuapp.com/register
Example response:
{
"api_key": "your_generated_api_key"
}
Store the api_key
and append ?api_key=your_api_key
to each of your API request URLs (except for /register
).
Returns an array of video objects. Contains only enough information to display in the sidebar.
GET https://brainflixback-f347c94ccf8f.herokuapp.com/videos?api_key=your_api_key
Example response:
[
{
"id": "84e96018-4022-434e-80bf-000ce4cd12b8",
"title": "The Future of Artificial Intelligence",
"channel": "Aiden Thompson",
"image": "https://brainflixback-f347c94ccf8f.herokuapp.com/images/image0.jpg"
},
{
"id": "c05b9a93-8682-4ab6-aff2-92ebb4bbfc14",
"title": "Exploring Cities of Europe",
"channel": "Maria Aziz",
"image": "https://brainflixback-f347c94ccf8f.herokuapp.com/images/image1.jpg"
}
]
Returns a detailed object of a single video, including the list of comments for that video.
GET https://brainflixback-f347c94ccf8f.herokuapp.com/videos/:id?api_key=your_api_key
Example response:
{
"id": "84e96018-4022-434e-80bf-000ce4cd12b8",
"title": "The Future of Artificial Intelligence",
"channel": "Aiden Thompson",
"image": "https://brainflixback-f347c94ccf8f.herokuapp.com/images/image0.jpg",
"description": "Explore the cutting-edge developments and predictions for Artificial Intelligence...",
"views": "980,544",
"likes": "22,479",
"duration": "4:01",
"video": "https://brainflixback-f347c94ccf8f.herokuapp.com/stream",
"timestamp": 1691471862000,
"comments": [
{
"name": "Noah Duncan",
"comment": "Your insights into the future of AI are enlightening...",
"id": "35bba08b-1b51-4153-ba7e-6da76b5ec1b9",
"likes": 0,
"timestamp": 1691731062000
}
]
}
Creates a new comment for a specific video.
POST https://brainflixback-f347c94ccf8f.herokuapp.com/videos/:id/comments?api_key=your_api_key
Example request body:
{
"name": "Trudy Jankowski",
"comment": "I really enjoyed this video! Thanks for posting"
}
Example response:
{
"id": "new_comment_id",
"name": "Trudy Jankowski",
"comment": "I really enjoyed this video! Thanks for posting",
"likes": 0,
"timestamp": 1691731062000
}
Deletes the given comment and returns it in the response body.
DELETE https://brainflixback-f347c94ccf8f.herokuapp.com/videos/:videoId/comments/:commentId?api_key=your_api_key
Example response:
{
"id": "ade82e25-6c87-4403-ba35-47bdff93a51c",
"name": "Maria Aziz",
"comment": "Your travel diaries are like a passport to wanderlust! Each city comes alive through your lens...",
"timestamp": 1690348662000
}
Increments the like count of a specific video.
POST https://brainflixback-f347c94ccf8f.herokuapp.com/videos/:id/like?api_key=your_api_key
Example response:
{
"id": "84e96018-4022-434e-80bf-000ce4cd12b8",
"title": "The Future of Artificial Intelligence",
"channel": "Aiden Thompson",
"image": "https://brainflixback-f347c94ccf8f.herokuapp.com/images/image0.jpg",
"description": "Explore the cutting-edge developments and predictions for Artificial Intelligence...",
"views": "980,544",
"likes": "22,480",
"duration": "4:01",
"video": "https://brainflixback-f347c94ccf8f.herokuapp.com/stream",
"timestamp": 1691471862000,
"comments": [
{
"name": "Noah Duncan",
"comment": "Your insights into the future of AI are enlightening...",
"id": "35bba08b-1b51-4153-ba7e-6da76b5ec1b9",
"likes": 0,
"timestamp": 1691731062000
}
]
}