Skip to content

Instantly share code, notes, and snippets.

@pwightman
Created November 12, 2012 20:18
Show Gist options
  • Save pwightman/4061623 to your computer and use it in GitHub Desktop.
Save pwightman/4061623 to your computer and use it in GitHub Desktop.
Logging into TA Queue

Get token

httparty -a post \
-H Accept:application/json -H Content-Type:application/json \
-d '{ "student": { "username":"mike liu", "location":"home" } }' \
"http://nine.eng.utah.edu/schools/uofu/eparker/CS1400/students"

Sample response:

{
  "location": "home",
  "token":    "f48ec550-dc36-4f2f-a517-aed985389a00",
  "id":       "50a159146cdd41bc19000004",
  "username": "mike liu"
}

Get queue data

httparty -a get -H Accept:application/json \
-H Content-Type:application/json \
-u <id>:<token> "http://localhost:3000/queue"

Sample response:

{"frozen": false,
 "is_question_based": false,
 "active":true,
 "status":"",
 "students":
  [{"id":"5006f99dd896ebdb55000056",
    "question":null,
    "username":"Parker",
    "location":"foo",
    "in_queue":false,
    "ta_id":null},
   {"id":"50a159146cdd41bc19000004",
    "question":null,
    "username":"mike liu",
    "location":"home",
    "in_queue":false,
    "ta_id":null}],
 "tas":
  [{"id":"509afe71bea48b833d000010", "username":"Parker", "student":null},
   {"id":"509affd3bea48b833d000018", "username":"foofoo", "student":null}]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment