Skip to content
kormang edited this page Jul 23, 2015 · 33 revisions

#Database

  • Initial database created for demo purposes on 14th of July. Changes will be made.
  • Currently, in our initial database we have video collection, which contains the following document fields : _id, title, description, duration, author and path.
  • Added another collection Tag(_id, name) in the second sprint.
  • Instruction for using database on localhost: mongorestore --drop -d video_annotations directory-of-dumped-backup . Change in mongodb.js databaseUrl to 'mongodb://127.0.0.1:27017/video_annotations';

#Services

##Getting list of videos

  • GET: /videos This returns all videos without the path/source
  • GET: /videos?skip=number of videos to skip&limit=number of videos to return Here skip and limit parameters are positive integer or zero in which case it's same as without parameters.
Example of response:
[
{
   "_id":"55a50e8f8a9463a1b4f84f88",
   "title":"Video about learning",
   "description":"Learn all about your future",
   "duration":12345,"author":"John Doe",
   "path":"/videocontent/video0.mp4"
},

{
   "_id":"55a50f288a9463a1b4f84f89",
   "title":"Angular JS all about",
   "description":"Easiest tutorial ever",
   "duration":1230123,"author":"Jane Doe",
   "path":"/videocontent/video1.mp4"
}
]

Empty array (arr.length == 0) means that there are no (more) results.

  • GET: /videos/:id Finds and returns one video from the database by _id
{
 "_id":"55a50e8f8a9463a1b4f84f88",
 "title":"Video about learning",
 "description":"Learn all about your future",
 "duration":12345,
 "author":"John Doe",
 "path":"/videocontent/video0.mp4",
 "annotations":[
    {
     "id":"55a7a50cf5fe9d10b6f3b75b",
     "text":"Text",
     "dateCreated":"2014-12-02T23:00:00.000Z", /* ISO date string format */
     "startTime":55555,"endTime":100000,
     "tags":[
             "55a77acb8a9463a1b4f84f8d"
      ]
    } ,

    {
     "id":"55a8b493852f4a2809482514",
     "text":"asdad",
     "dateCreated":"2015-07-17T07:53:55.137Z",
     "startTime":46,
     "endTime":"56",
     "tags":[
       "55a77aee8a9463a1b4f84f8e"
      ]
   }
 ]
}

##Adding annotation to video

  • POST: /annotation/:videoId/add Post parametars are text, startTime, endTime, tags.Example: text=Diplomski&startTime=5&endTime=10&tags=["55a77aee8a9463a1b4f84f8f", "55a77aee8a9463a1b4f84f8e"] startTime and endTime are in seconds, and tags are javascript array consisting of tag ids. A new annotation will be returned.

##Editing annotation

  • PUT: /annotation/:videoId/edit/:annotationId Put parametars are text, startTime, endTime, tags, as with adding new annotation. But but some parameters can be excluded in which case they won't be changed. Edited annotation will be returned.

##Deleting annotation

  • DELETE: /annotation/:videoId/remove/:annotationId

##Getting owner video statistic

  • GET: /owners/:videoId Server returns json object: "numberOfAnnotation":number,"countView":number,"lastViewDate":date

##Get tag list *GET: /tags Returns the list of tags.

##Register new user *POST: /register Post parameters are : email and password. Example : email=[email protected]&password=test. If the email is incorrect or its not entered server will notify with message: "Email is mandatory"; and if password is left empty server will reply with: "Password is mandatory"; if user with that email already exists server will reply with: {status: "Error", message: "User with that email already exists"}; if user successfully entered correct data server will reply with: {status: "success", message: "Mail confirmation sent"};

##Search for videos and annotations *GET: /searchvideos Get query parameters are : text, skip and limit, while skip and limit are optional. The service return the array of videos, where each video has one or both of following properties: videoMatches and annotationsMatches. If property exist it's set to true. Example of get service: /searchvideos?text=example&skip=1&limit=5.

##User login *POST: /login Post parameters are: email and password. Example: email=[email protected]&password=test. If log in has been successful server will reply with: {status: "success", message: "User successfully logged in"}; if the email or password are incorrect server will replay with: {status: "error", meassage: "User not found"}; if the user is not active server will reply with: {status: "error", message: "Users email is not verified"}; if the email or password field is left blank server will reply with one of the messages: "Email is mandatory", "Password is mandatory".

##Check if user consent is required to set cookies and track user data (Cookie Low in EU contries) *GET: /userconsentrequired Will return true if user consent is required to set cookies (user from which computer request is sent is in EU). Otherwise, returns false.

Clone this wiki locally