wiki:api_v1

Version 12 (modified by Pan Luo, 12 years ago) ( diff )

--

Overview

This is the first version of API. The main purpose of this version of API is to provide a way for external applications, e.g., learning management system, to interact with iPeer with tighter integration and better user experience. Data returned will be in JSON format with XML support coming later.

Authentication

OAuth 1.0a

Resources

Users

GET/v1/usersget a list of users
parameternone
inputnone
status (success)HTTP/1.0 200 OK
output (success)[{"id":"USER0_ID","role_id":"ROLE_ID","username":"USERNAME0","last_name":"LAST_NAME","first_name":"FIRST_NAME"},{"id":"USER1_ID","role_id":"ROLE_ID","username":"USERNAME1","last_name":"LAST_NAME","first_name":"FIRST_NAME"}]
status (failure)HTTP/1.0 404 Not Found
output (failure)null
GET/v1/users/{id}get a user with id
parameterUSER_ID
inputnone
status (success)HTTP/1.0 200 OK
output (success)[{"id":"USER0_ID","role_id":"ROLE_ID","username":"USERNAME0","last_name":"LAST_NAME","first_name":"FIRST_NAME"}]
status (failure)HTTP/1.0 404 Not Found
output (failure)null
POST/v1/userscreate a user
parameternone
input[{"role_id":"ROLE_ID","username":"USERNAME","last_name":"LAST_NAME","first_name":"FIRST_NAME"}]
status (success)HTTP/1.0 201 CREATED
output (success)[{"id":"USER_ID","role_id":"ROLE_ID","username":"USERNAME","last_name":"LAST_NAME","first_name":"FIRST_NAME"}]
status (failure)HTTP/1.0 500 Internal Server Error
output (failure)null
POST/v1/userscreate users
parameternone
input[{"role_id":"ROLE_ID","username":"USERNAME0","last_name":"LAST_NAME","first_name":"FIRST_NAME"},{"role_id":"ROLE_ID","username":"USERNAME1","last_name":"LAST_NAME","first_name":"FIRST_NAME"}]
status (success)HTTP/1.0 201 CREATED
output (success)[{"id":"USER0_ID","role_id":"ROLE_ID","username":"USERNAME0","last_name":"LAST_NAME","first_name":"FIRST_NAME"},{"id":"USER1_ID","role_id":"ROLE_ID","username":"USERNAME1","last_name":"LAST_NAME","first_name":"FIRST_NAME"}]
status (failure)HTTP/1.0 500 Internal Server Error
output (failure)null
DELETE/v1/users/{id}remove a user with id
parameterUSER_ID
inputnone
status (success)HTTP/1.0 204 No Content
output (success)null
status (failure)HTTP/1.0 500 Internal Server Error
output (failure)null
PUT/v1/users/{id}update a user with id
parameterCOURSE_ID
input[{"id":"USER_ID","username":"USERNAME","last_name":"LAST_NAME","first_name":"FIRST_NAME","role_id":"ROLE_ID"}]
status (success)HTTP/1.0 200 OK
output (success)[{"id":"USER_ID","username":"USERNAME","last_name":"LAST_NAME","first_name":"FIRST_NAME","role_id":"ROLE_ID"}]
status (failure)HTTP/1.0 500 Internal Server Error
output (failure)null

Courses

GET/v1/coursesget a list of courses for current logged in user
parameternone
inputnone
status (success)HTTP/1.0 200 OK
output (success)[{"id":"COURSE0_ID","course":"COURSE0_CODE","title":"COURSE0_TITLE"},{"id":"COURSE1_ID","course":"COURSE1_CODE","title":"COURSE1_TITLE"}]
status (failure)HTTP/1.0 404 Not Found
output (failure)No courses can be found
GET/v1/courses/{id}get a course with id
parameterCOURSE_ID
inputnone
status (success)HTTP/1.0 200 OK
output (success){"id":"COURSE_ID","course":"COURSE_CODE","title":"COURSE_TITLE"}
status (failure)HTTP/1.0 404 Not Found
status (failure)No course with id COURSE_ID can be found
POST/v1/coursescreate a course
parameternone
input{"Course":{"course":"COURSE_CODE","title":"COURSE_TITLE"},"Department":{"Department":[DEPARTMENT_ID]}}
status (success)HTTP/1.0 201 Created
output (success)COURSE_ID
status (failure)HTTP/1.0 500 Internal Server Error
output (failure)Error: the course was not added
DELETE/v1/courses/{id}remove a course with id
parameterCOURSE_ID
inputnone
status (success)HTTP/1.0 204 No Content
output (success)COURSE_ID
status (failure)HTTP/1.0 500 Internal Server Error
output (failure)Error: the course was not deleted
PUT/v1/courses/{id}update a course with id
parameternone
input{"Course":{"id":"COURSE_ID","course":"COURSE_CODE","title":"COURSE_TITLE"}}
status (success)HTTP/1.0 200 OK
output (success)COURSE_ID
status (failure)HTTP/1.0 500 Internal Server Error
output (failure)Error: the course was not edited

Courses/Users

GET/v1/courses/{course_id}/usersget a list of users associated within the course {course_id}
POST/v1/courses{course_id}/users/{user_id}associate a user to the course by {course_id}
POST/v1/courses{course_id}/usersassociate users to the course by {course_id}
DELETE/v1/courses/{course_id}/users/{user_id}remove a user from the course
DELETE/v1/courses/{course_id}/usersremove users from the course
parameterCOURSE_ID
inputnone for removing all users or [{"id":1},{"id":2},{"id":3}] for specific users (other fields are ignored)
status (success)HTTP/1.0 204 No Content
output (success)COURSE_ID
status (failure)HTTP/1.0 500 users were not deleted
output (failure) none

Groups

GET/v1/courses/{course_id}/groupsget a list of groups in course {course_id}
GET/v1/courses/{course_id}/groups/idget a group in course by group id, course_id will be ignored
POST/v1/courses{course_id}/groupscreate a group in course {course_id}
DELETE/v1/courses/{course_id}/groups/{id}remove a group in course by group id, course_id will be ignored
PUT/v1/courses/{course_id}/groups/{id}update a group in course by group id, course_id will be ignored

Groups/Users

GET/v1/groups/{group_id}/usersget a list of users associated within the group {group_id}
GET/v1/groups/{group_id}/users/{user_id}get a user in group by {group_id}
POST/v1/groups{group_id}/users/{user_id}associate users to the group by {group_id}
POST/v1/groups{group_id}/usersassociate users to the group by {group_id}
DELETE/v1/groups/{group_id}/users/{user_id}remove a user from the group
DELETE/v1/groups/{group_id}/usersremove users from the group

Grades

GET/v1/courses/{course_id}/gradesget a list of grades in course {course_id}
GET/v1/courses/{course_id}/grades/idget a grades in course {course_id}
GET/v1/users/{user_id}/gradesget grades for a user
  • Grades are read-only

Events

GET/v1/courses/{course_id}/eventsget a list of events in course {course_id}
GET/v1/courses/{course_id}/events/{event_id}get a event in course {course_id}
GET/v1/users/{user_id}/eventsget events for a user
  • Events are read-only
Note: See TracWiki for help on using the wiki.