Skip to content

REST Interface: Accent

jrf2 edited this page Jul 7, 2012 · 24 revisions

Implemented Comands

  • None of the REST commands on this page have been fully implemented yet.

Unimplemented - Draft Specification

Tags

Get Tags Belonging to a User

  • update a tag
  • Method: GET
  • Path: /user/0/tags
  • Request: { }
  • success:
  • Response: { errorcode: 0, tags: [{ tag_id: 0 }, { tag_id: 1 }] }
  • error: file not found
  • Response: { errorcode: 1, message: "user not found" }

Get Most Recent Tag Belonging to a User

  • update a tag
  • Method: GET
  • Path: /user/0/tags/latest
  • Request: { }
  • success:
  • Response: { errorcode: 0, tag_id: 0 }
  • success: but user has not tags
  • Response: { errorcode: 0, tag_id: -1 }
  • error: file not found
  • Response: { errorcode: 1, message: "user not found" }

Get Tags Beloning to a File

  • update a tag
  • Method: GET
  • Path: /file/0/tags
  • Request: { }
  • success:
  • Response: { errorcode: 0, tags: [{ tag_id: 0 }, { tag_id: 1 }] }
  • error: file not found
  • Response: { errorcode: 1, message: "file not found" }

Add Tag to a File

  • adds a tag
  • Request: { command: "addtag", file_id: 0, user_id: 0, start: 0, end: 120, Category: 0 }
  • success
  • error: file_id not found in database
  • error: start time is greater than end time
  • error: category is not valid
  • error: user id is not found in database
  • error: command != "addtag"

Update Tag

  • update a tag
  • Method: PUT
  • Path: /tag/0
  • Request: { start: 25, end: 100 }
  • success:
  • Response: { errorcode: 0 }
  • error: tag not found
  • Response: { errorcode: 1, message: "tag not found" }

Delete Tag

  • deletes a tag
  • Method: DELETE
  • Path: /tag/0
  • Request: { }
  • success
  • Response: { errorcode: 0 }
  • error: tag id not found in database
  • Response: { errorcode: 1, message: "tag id not found in database" }

File

Get File

  • get the complete info of an individual file
  • Method: GET
  • Path: /file/0
  • Request: { }
  • success:
  • Response: { data: "data" }
  • error: file not found
  • Response: { errorcode: 1, message: "file not found" }

Get Files by User

  • get a list of all the file ids associated with a user
  • Method: GET
  • Path: /user/0/files
  • Request: { }
  • success:
  • Response: { errorcode: 0, files: [{ file_id: 0 }, { file_id: 1 }] }
  • success: but user has not files
  • Response: { errorcode: 0, files: [ ] }

Get Files by Course

  • get a list of all the file ids associated with a course
  • Method: GET
  • Path: /course/0/files
  • Request: { }
  • success:
  • Response: { errorcode: 0, files: [{ file_id: 0 }, { file_id: 1 }] }
  • success: but user has not files
  • Response: { errorcode: 0, files: [ ] }

Get Files by Study Group

  • get a list of all the file ids associated with a study group
  • Method: GET
  • Path: /studygroup/0/files
  • Request: { }
  • success:
  • Response: { errorcode: 0, files: [{ file_id: 0 }, { file_id: 1 }] }
  • success: but user has not files
  • Response: { errorcode: 0, files: [ ] }

Get File from Tag

  • get the file id of a resource given the id of a tag
  • Method: GET
  • Path: /tag/0/file
  • Request: { }
  • success:
  • Response: { errorcode: 0, file_id: 0 }
  • error: tag not found
  • Response: { errorcode: 1, message: "tag not found" }

Add File

  • adds a file
  • Method: POST
  • Path: /file/add
  • Request: { title:"mytitle", path: "mypath", category_id: 0 }
  • success:
  • Response: { errorcode: 0 }

Update File

  • updates a file
  • Method: PUT
  • Path: /file/0
  • Request: { title:"newtitle"}
  • success:
  • Response: { errorcode: 0 }
  • error: file not found
  • Response: { errorcode: 1, message: "file not found" }

Delete File

  • deletes a file
  • Method: DELETE
  • Path: /file/0
  • Request: { }
  • success:
  • Response: { errorcode: 0 }
  • error: file not found
  • Response: { errorcode: 1, message: "file not found" }
Clone this wiki locally