-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Introduction
The purpose of this REST API is to retrieve a list of videos that are stored inside the Ocean Observatories website. From this API, we should be able to retrieve an array of video metadata. There are two parts of this project: implementing the GET endpoint and use the information from the API to display in the frontend.
Concepts gained from here:
- REST API
- Package management
- Python best practices
- Unit tests
Part 1. Implement the Video List API
Endpoint Specification
The endpoint that we should implement is
GET /videos/
Hitting this endpoint should return:
[
{
"id" [String],
"name": [String],
"frame_count": [Integer],
"date": [String],
"url": [String]
},
.
.
.
]The descriptions of each property of the metadata is as follows:
-
"id": This should represent a unique representation of each video, since we do not know the ID of the videos retrieved, let us make one by hashing the URL (using md5). This will be used both internally in our Kafka system, and the endpoint.
-
"name": This should be just a human readable name format, could be the last part of the URL for now.
-
"frame_count": This should return the number of frames the video has.
-
"date": This should be the date of when the video was taken. This should conform to the ISO8601 format.
-
"url": Return the url of the video.
Steps Overview
- Play around with either Beautiful Soup or PyCamHD on a script somewhere. The PyCamHD library especially has a function where you can get a list of MOV files in the server. The link to get the files is under
https://rawdata.oceanobservatories.org/files/. PyCamHD seems to suffice, but if you need to get something from Beautiful Soup, then that is fine. - Once you are comfortable with working with the libraries, add them to
backend/requirements.txtthen rebuild the Docker images. Be aware that if you think you don't need both of them, don't add both of them. - Add your endpoint under
backend/server/oceanhub/videos/views.py, read up a little bit on Flask's endpoint setup in here. - Make sure you
jsonifythe response, we want to return a JSON-serialized response. - Add tests to the endpoint, use the How to Test your Flask Application to add the tests. Also, test your class / functions if you create them, for the code level tests, use Py.test, here is a quick intro to it: https://github.com/pluralsight/intro-to-pytest.
Additional Information
- @scaraclette will be working on this mostly. But, if anybody would like to get involved, feel free to say so then we will try to divide the work.
- Initial soft-deadline is at August 14th, 2018 for Part 1, but if you need more time let us know. This is just to keep track of time.