PC² REST services

From PC2wiki
Jump to: navigation, search

On the Event Feed module REST service provide contest data.

REST services are in version 9.3.2 and later versions of pc2.

Starting REST Services

Steps:

  1. Start Server
  2. Start Admin
  3. Generate one FEEDER Account
  4. Start Event Feed module
    1. Login: feeder1
    2. Password: feeder1
  5. Select Web Services tab
  6. Click Start button

The status title should change to "Web Server is running..."

REST Services

All REST services produce JSON output.

teams

Fetch data use this URL in a browser:

https://localhost:50443/teams


Sample output:

[{"id":39,"name":"team39","nationality":"null","affliliation":"null","group":"null"}, {"id":38,"name":"team38","nationality":"null","affliliation":"null","group":"null"}, {"id":37,"name":"team37","nationality":"null","affliliation":"null","group":"null"}, {"id":36,"name":"team36","nationality":"null","affliliation":"null","group":"null"}, {"id":35,"name":"team35","nationality":"null","affliliation":"null","group":"null"}, {"id":34,"name":"team34","nationality":"null","affliliation":"null","group":"null"}, {"id":33,"name":"team33","nationality":"null","affliliation":"null","group":"null"}, {"id":32,"name":"team32","nationality":"null","affliliation":"null","group":"null"}, {"id":31,"name":"team31","nationality":"null","affliliation":"null","group":"null"}, {"id":30,"name":"team30","nationality":"null","affliliation":"null","group":"null"}, {"id":9,"name":"Team D","nationality":"USA","affliliation":"TeamX D","group":"Open Division"}, {"id":8,"name":"Team I","nationality":"USA","affliliation":"TeamX I","group":"Open Division"}, {"id":7,"name":"Team M","nationality":"USA","affliliation":"TeamX M","group":"Open Division"}, {"id":6,"name":"Team C","nationality":"USA","affliliation":"TeamX C","group":"Open Division"}, {"id":5,"name":"Team F","nationality":"USA","affliliation":"TeamX F","group":"Open Division"}, {"id":4,"name":"Team K","nationality":"USA","affliliation":"TeamX K","group":"Open Division"}, {"id":3,"name":"Team R","nationality":"USA","affliliation":"TeamX R","group":"Open Division"}, {"id":2,"name":"Team J","nationality":"USA","affliliation":"TeamX J","group":"Open Division"}, {"id":29,"name":"team29","nationality":"null","affliliation":"null","group":"null"}, {"id":1,"name":"Team W","nationality":"USA","affliliation":"TeamX W","group":"Open Division"},

problems

Fetch data use this URL

https://localhost:50443/problems

Sample output:

[{"id":1,"label":"A","short_name":"A-tortoise","name":"The Tortoise and the Hare","rgb":"null","color":"fixme!"},{"id":2,"label":"B","short_name":"B-buoys","name":"Space Buoys","rgb":"null","color":"fixme!"},{"id":3,"label":"C","short_name":"C-friends","name":"Friends","rgb":"null","color":"fixme!"},{"id":4,"label":"D","short_name":"D-glumpsort","name":"Glump Sort","rgb":"null","color":"fixme!"},{"id":5,"label":"E","short_name":"E-flag","name":"Make a Flag","rgb":"null","color":"fixme!"},{"id":6,"label":"F","short_name":"F-flattener","name":"The Flattener","rgb":"null","color":"fixme!"},{"id":7,"label":"G","short_name":"G-mountain","name":"Mountain Climbing","rgb":"null","color":"fixme!"}]

languages

Fetch data use this URL

https://localhost:50443/languages

Sample output

[{"id":1,"name":"Java"},{"id":2,"name":"C++"},{"id":3,"name":"C"},{"id":4,"name":"Python"},{"id":5,"name":"Python 3"}]

scoreboard

Fetch data use this URL

https://localhost:50443/scoreboard

Sample output

[{"rank":1,"team":9,"score":{"num_solved":5,"total_time":665},"problems":[{"label":"A","num_judged":2,"num_pending":0,"solved":true,"time":18,"first_to_solve":true},{"label":"B","num_judged":1,"num_pending":0,"solved":true,"time":125,"first_to_solve":false},{"label":"C","num_judged":1,"num_pending":0,"solved":true,"time":100,"first_to_solve":true},{"label":"D","num_judged":1,"num_pending":0,"solved":true,"time":167,"first_to_solve":false},{"label":"E","num_judged":0,"num_pending":0,"solved":false},{"label":"F","num_judged":2,"num_pending":0,"solved":true,"time":235,"first_to_solve":false},{"label":"G","num_judged":0,"num_pending":0,"solved":false}]},{"rank":2,"team":16,"score":{"num_solved":5,"total_time":832},"problems":[{"label":"A","num_judged":2,"num_pending":0,"solved":true,"time":19,"first_to_solve":false},{"label":"B","num_judged":3,"num_pending":0,"solved":true,"time":105,"first_to_solve":false},{"label":"C","num_judged":3,"num_pending":0,"solved":true,"time":197,"first_to_solve":false},{"label":"D","num_judged":1,"num_pending":0,"solved":true,"time":223,"first_to_solve":false},{"label":"E","num_judged":0,"num_pending":0,"solved":false},{"label":"F","num_judged":1,"num_pending":0,"solved":true,"time":188,"first_to_solve":false},{"label":"G","num_judged":0,"num_pending":0,"solved":false}]},{"rank":3,"team":8,"score":{"num_solved":4,"total_time":485},"problems":[{"label":"A","num_judged":1,"num_pending":0,"solved":true,"time":21,"first_to_solve":false},{"label":"B","num_judged":2,"num_pending":0,"solved":true,"time":35,"first_to_solve":true},{"label":"C","num_judged":0,"num_pending":0,"solved":false},{"label":"D","num_judged":0,"num_pending":0,"solved":false},{"label":"E","num_judged":2,"num_pending":0,"solved":true,"time":186,"first_to_solve":true},{"label":"F","num_judged":3,"num_pending":0,"solved":true,"time":183,"first_to_solve":true},{"label":"G","num_judged":0,"num_pending":0,"solved":false}]},{"rank":4,"team":4,"score":{"num_solved":4,"total_time":519},"problems":[{"label":"A","num_judged":1,"num_pending":0,"solved":true,"time":29,"first_to_solve":false}]

See Also

Draft CCS specs: