sriramrathinavelu / attendanceSWE2015

Attendance application for SWE 2015
1 stars 2 forks source link

Request for API - Login #60

Closed winddweb closed 9 years ago

winddweb commented 9 years ago

@sriramrathinavelu I saw you added the course array in the response. Since my test accounts don't have any course yet, I see an empty array. Just to make sure things are clear, I want you to understand what I want. Feel free to change the structure of the array if necessary.

@TaniaSolo , please have a look and see if you have any suggestions

Now:

// JSON:

 {
  "first_name" : null,
  "email" : "test1001@itu.edu",
  "last_name" : null,
  "courses" : [
    "YSY 900-2",
    "SWE 500-1" 
  ] 
  // I suppose this is a array which contains course_key only?
}

What I want:

// JSON:

 {
  "first_name" : null,
  "email" : "test1001@itu.edu",
  "last_name" : null,
  "courses" : [
    {
        "course_name"       :   "Course Test 1",
        "course_code"       :   "YSY 900",
        "course_section"    :   "2",
        "class_room"        :   "room2",
        "duration_start"    :   "2015-09-15T00:00:00",
        "duration_end"      :   "2016-01-04T00:00:00",
        "time_start"        :   "2015-01-01T20:00:00",
        "time_end"          :   "2015-01-01T22:00:00",
        "trimester"         :   "Fall 2015",
        "professor"         :   "test1001@itu.edu",
        "day_of_week"       :   "0"
    },
    {
        "course_name"       :   "Course Test 2",
        "course_code"       :   "SSS 500",
        "course_section"    :   "2",
        "class_room"        :   "room2",
        "duration_start"    :   "2015-09-15T00:00:00",
        "duration_end"      :   "2016-01-04T00:00:00",
        "time_start"        :   "2015-01-01T20:00:00",
        "time_end"          :   "2015-01-01T22:00:00",
        "trimester"         :   "Fall 2015",
        "professor"         :   "test1001@itu.edu",
        "day_of_week"       :   "0"
    }
  ]
}
sriramrathinavelu commented 9 years ago

Use this request. I will update in the APIARY tomorrow the exact format, but the request goes like this

/professor/{email}/courses /student/{email}/courses

This may not work for existing courses. So add a new courses and this GET request should return results

Example: http http://localhost:8000/professor/prof1@itu.edu/courses/ Authorization:'Token 553e065cfe92093ed7a819184826bde00b7a68010802' HTTP/1.0 200 OK Allow: GET, HEAD, OPTIONS Content-Type: application/json Date: Wed, 02 Dec 2015 10:35:49 GMT Server: WSGIServer/0.1 Python/2.7.3 Vary: Accept X-Frame-Options: SAMEORIGIN

[ { "class_room": "room2", "course_code": "600", "course_key": "600-1", "course_name": "Software Engineering", "course_section": "1", "day_of_week": 1, "duration_end": "2016-01-04T00:00:00", "duration_start": "2015-09-15T00:00:00", "professor": "prof1@itu.edu", "time_end": "2015-01-01T22:00:00", "time_start": "2015-01-01T20:00:00", "trimester": "Fall 2015" } ]

sriramrathinavelu commented 9 years ago

Hi @winddweb , I have updated the new API in the APIARY. Please look for

1) Professor Course Collection 2) Student Course Collection

in the APIARY reference.

Am closing the issue. Please reopen if required.

Thanks Sriram