sriramrathinavelu / attendanceSWE2015

Attendance application for SWE 2015
1 stars 2 forks source link

Questions about API ( Classroom, Course ) #62

Open winddweb opened 8 years ago

winddweb commented 8 years ago

Q1 when I try to add a course, I got a error message says, "Invalid classroom". So i want to know the details about the valid classrooms.

# this is the JSON I send to the server, 
[
"course_section": 1, 
"course_code": SSA 303, 
"day_of_week": 0, 
"duration_end": 2016-01-11T00:00:00, 
"trimester": Spring 2016, 
"time_start": 2000-01-01T05:35:00, 
"course_key": SSA 303-1, 
"course_name": Course Name,
"time_end": 2000-01-01T17:45:00, 
"duration_start": 2015-12-11T00:00:00, 
"professor": aa@itu.edu, 
"class_room": 202
]

# the response
"http://23.236.59.88:8000/weekdaycourse/"
[Request]: <NSMutableURLRequest: 0x7cd7d3f0> { URL: http://23.236.59.88:8000/weekdaycourse/ }
[Response]: <NSHTTPURLResponse: 0x7cd6b110> { URL: http://23.236.59.88:8000/weekdaycourse/ } { status code: 400, headers {
    Allow = "GET, POST, HEAD, OPTIONS";
    "Content-Type" = "application/json";
    Date = "Sat, 12 Dec 2015 01:37:52 GMT";
    Server = "WSGIServer/0.1 Python/2.7.3";
    Vary = Accept;
    "X-Frame-Options" = SAMEORIGIN;
} }
[Data]: 20 bytes
[Result]: SUCCESS: Invalid Class Room

Q2 I want to know about any restrictions about updating a course info. Such as, is it true that only the owner of the course can update it ( course.professor = user.email ? ). Is there any other rules?

For example

# This is supposed to be editing a course, but it's never added to the server before, so I think acts like adding a new course
# The user's email is aa@itu.edu, which is different from the `professor` field in the JSON

["course_section": 1, "course_code": SWE 610, "day_of_week": 0, "duration_end": 2016-01-04T00:00:00, "trimester": Fall 2015, "time_start": 2000-01-01T20:00:00, "course_key": SWE 610-1, "course_name": Ruby on Rails, "time_end": 2000-01-01T22:00:00, "duration_start": 2015-09-15T00:00:00, "professor": test1001@itu.edu, "class_room": 406]

"http://23.236.59.88:8000/weekdaycourse/"
[Request]: <NSMutableURLRequest: 0x7b1f3250> { URL: http://23.236.59.88:8000/weekdaycourse/ }
[Response]: <NSHTTPURLResponse: 0x7cd746b0> { URL: http://23.236.59.88:8000/weekdaycourse/ } { status code: 403, headers {
    Allow = "GET, POST, HEAD, OPTIONS";
    "Content-Type" = "application/json";
    Date = "Sat, 12 Dec 2015 01:48:23 GMT";
    Server = "WSGIServer/0.1 Python/2.7.3";
    Vary = Accept;
    "X-Frame-Options" = SAMEORIGIN;
} }
[Data]: 39 bytes
[Result]: SUCCESS: You do not have sufficient permission

Q3 here's the result I got from the "get classroom list API". I don't see what you talked about in last meeting, such as the coordinates information.

And I want to know how is this supposed to be working with our adding course request. If you only allow a list of classrooms to be valid, we need to provide that in the add course form, and make it a dropdown list?

[Request]: <NSMutableURLRequest: 0x797d8b10> { URL: http://23.236.59.88:8000/classrooms/ }
[Response]: <NSHTTPURLResponse: 0x796bc3a0> { URL: http://23.236.59.88:8000/classrooms/ } { status code: 200, headers {
    Allow = "GET, HEAD, OPTIONS";
    "Content-Type" = "application/json";
    Date = "Sat, 12 Dec 2015 01:43:26 GMT";
    Server = "WSGIServer/0.1 Python/2.7.3";
    Vary = Accept;
    "X-Frame-Options" = SAMEORIGIN;
} }
[Data]: 35 bytes
[Result]: SUCCESS: (
        {
        code = r1;
        name = Auditorium;
    }
)