Difference between revisions of "PC² REST services"

From PC2wiki
Jump to: navigation, search
m (languages: added sample)
m (Starting REST Services: add startup steps)
Line 5: Line 5:
 
= Starting REST Services =
 
= Starting REST Services =
  
See
+
Steps:
 +
# Start Server
 +
# Start Admin
 +
# Generate [[FEEDER]] Account
 +
# Start [[Event Feed module]]
 +
## Login: <tt>feeder1</tt>
 +
## Password: <tt>feeder1</tt>
 +
# Select Web Services tab
 +
# Click Start button
 +
 
 +
The status title should change to "Web Server is running..."
  
 
= REST Services =
 
= REST Services =

Revision as of 11:47, 11 September 2016

CCS REST service were added to pc2 as a way to 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 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":"Darren Takemoto/Gabe Thompson/Nickolus Clayton","nationality":"USA","affliliation":"Darren Takemoto/Gabe Thompson/Nickolus Clayton","group":"Open Division"},{"id":8,"name":"Isaac Lozano/Thierry Rutaganira/Kenny Ko","nationality":"USA","affliliation":"Isaac Lozano/Thierry Rutaganira/Kenny Ko","group":"Open Division"},{"id":7,"name":"Mathew Helmund/Sayd Mateen/Hasib Habibi","nationality":"USA","affliliation":"Mathew Helmund/Sayd Mateen/Hasib Habibi","group":"Open Division"},{"id":6,"name":"Connor Elison/Tom Solem/Oscar Solorzano","nationality":"USA","affliliation":"Connor Elison/Tom Solem/Oscar Solorzano","group":"Open Division"},{"id":5,"name":"Farhana Akter/Sharmaine Caoile/Katherine Amita","nationality":"USA","affliliation":"Farhana Akter/Sharmaine Caoile/Katherine Amita","group":"Open Division"},{"id":4,"name":"Kameryn Taylor/Mike Schmid/Samson Chua","nationality":"USA","affliliation":"Kameryn Taylor/Mike Schmid/Samson Chua","group":"Open Division"},{"id":3,"name":"Randy Scroggins/Alejandro Pena/Tyler Hamm","nationality":"USA","affliliation":"Randy Scroggins/Alejandro Pena/Tyler Hamm","group":"Open Division"},{"id":2,"name":"J Austin Dolve/Ezekiel Dohmen/Austin Purcell","nationality":"USA","affliliation":"J Austin Dolve/Ezekiel Dohmen/Austin Purcell","group":"Open Division"},{"id":29,"name":"team29","nationality":"null","affliliation":"null","group":"null"},{"id":1,"name":"Will Kinderman/Tiffany Wong/Justin Aquine","nationality":"USA","affliliation":"Will Kinderman/Tiffany Wong/Justin Aquine","group":"Open Division"},

problems

Fetch data use this URL

https://localhost:50443/problems

Sample [{"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 [{"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