Skip to content
kormang edited this page Jul 17, 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.

#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.

##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.

##Deleting annotation

  • DELETE: /annotation/:videoId/delete/:annotationId

Clone this wiki locally