API Judging Scores: Difference between revisions
From zFairs Contest Management
No edit summary |
Remove username/password API auth; ApiKey only |
||
| (2 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
== Judging Scores == | == Judging Scores == | ||
Two related endpoints: | |||
# '''Upload scores''' — <code>POST /api/data/JudgingScores</code> (also documented at [[API Upload Judging Score]]) | |||
# '''Get scores for a round''' — <code>POST /api/data/JudgingScoresForRound</code> | |||
=== Authentication === | |||
All data API calls are <code>POST</code> (unless noted) with JSON body: | |||
{| class="wikitable" | |||
|- | |||
! Field !! Required !! Description | |||
|- | |||
| <code>ApiKey</code> || Yes || Private API key for your site. | |||
|- | |||
| <code>FairId</code> || Yes || Fair GUID from the site URL (<code>f</code> query parameter). | |||
|- | |||
| <code>Body</code> || Depends || Request payload. Use <code>{}</code> when no body fields are needed. | |||
|} | |||
Calls must be run '''server-side''' — do not expose your API key in a browser. | |||
=== Response envelope === | |||
Most endpoints return: | |||
<pre> | |||
{ | |||
Success: true, | |||
Message: null, // error text when Success is false | |||
Body: { ... } // endpoint-specific payload | |||
} | |||
</pre> | |||
=== Upload scores === | |||
See [[API Upload Judging Score]] for the full request shape (<code>RoundId</code>, <code>ClearOldScores</code>, <code>Assignments</code> with <code>ProjectKey</code>, <code>JudgeId</code>, <code>Score</code>, <code>Notes</code>). | |||
=== Get scores for a round === | |||
<syntaxhighlight lang="JavaScript" line> | <syntaxhighlight lang="JavaScript" line> | ||
fetch('/api/data/JudgingScoresForRound', { | fetch('/api/data/JudgingScoresForRound', { | ||
method:'POST', | method:'POST', | ||
headers:{'Content-Type': 'application/json'}, | headers:{'Content-Type': 'application/json'}, | ||
body: JSON.stringify({ | body: JSON.stringify({ | ||
ApiKey:'<Private key>', | |||
FairId: '9df61f13-474b-442f-ac1f-edca7348ef71', | |||
FairId: '9df61f13-474b-442f-ac1f-edca7348ef71', | |||
Body: { | Body: { | ||
RoundId: | RoundId: 2, | ||
ClearOldScores: false // WARNING: if true this CLEARS scores before reading | |||
} | |||
}) | }) | ||
}) | }) | ||
| Line 19: | Line 54: | ||
.then(data=>{console.log('Success: ',data);}) | .then(data=>{console.log('Success: ',data);}) | ||
.catch((error)=>{console.log('Error: ', error);}); | .catch((error)=>{console.log('Error: ', error);}); | ||
</syntaxhighlight> | |||
==== Response ==== | |||
<syntaxhighlight lang="JavaScript"> | |||
{ | |||
Success: true, | |||
Message: null, | |||
Body: [{ | |||
ProjectId: "AB-100", | |||
At: "2024-03-15T10:00:00", // adjusted to fair timezone | |||
Score: 95.5, | |||
Notes: "Strong methodology", | |||
NoShow: false, | |||
Rubric: "Main Rubric", | |||
ScoreBreakdown: [ | |||
{ Id: "q1", Name: "Scientific method", Score: "5" } | |||
], | |||
JudgeId: 9001, | |||
JudgePublicId: "judge-public-guid", | |||
JudgeName: "Sam Judge" | |||
}] | |||
} | |||
</syntaxhighlight> | </syntaxhighlight> | ||
=== Field notes === | |||
* Round ids come from [[API Get Info]] → <code>Rounds</code>. | |||
* On the get endpoint, <code>ClearOldScores: true</code> will clear the round scores before returning results — leave it false unless you intend to wipe scores. | |||
* Score breakdown is only returned when rubric detail data is available for the assessment. | |||
=== Related APIs === | |||
* [[API Upload Judging Score]] | |||
* [[API Set Judging Assignments]] | |||
* [[API Get Judges]] / [[API Get Projects]] / [[API Get Info]] | |||
<br/><br/> | |||
[[Category: API]] | [[Category: API]] | ||
Latest revision as of 11:55, 25 July 2026
Judging Scores
Two related endpoints:
- Upload scores —
POST /api/data/JudgingScores(also documented at API Upload Judging Score) - Get scores for a round —
POST /api/data/JudgingScoresForRound
Authentication
All data API calls are POST (unless noted) with JSON body:
| Field | Required | Description |
|---|---|---|
ApiKey |
Yes | Private API key for your site. |
FairId |
Yes | Fair GUID from the site URL (f query parameter).
|
Body |
Depends | Request payload. Use {} when no body fields are needed.
|
Calls must be run server-side — do not expose your API key in a browser.
Response envelope
Most endpoints return:
{
Success: true,
Message: null, // error text when Success is false
Body: { ... } // endpoint-specific payload
}
Upload scores
See API Upload Judging Score for the full request shape (RoundId, ClearOldScores, Assignments with ProjectKey, JudgeId, Score, Notes).
Get scores for a round
fetch('/api/data/JudgingScoresForRound', {
method:'POST',
headers:{'Content-Type': 'application/json'},
body: JSON.stringify({
ApiKey:'<Private key>',
FairId: '9df61f13-474b-442f-ac1f-edca7348ef71',
Body: {
RoundId: 2,
ClearOldScores: false // WARNING: if true this CLEARS scores before reading
}
})
})
.then(response => response.json())
.then(data=>{console.log('Success: ',data);})
.catch((error)=>{console.log('Error: ', error);});Response
{
Success: true,
Message: null,
Body: [{
ProjectId: "AB-100",
At: "2024-03-15T10:00:00", // adjusted to fair timezone
Score: 95.5,
Notes: "Strong methodology",
NoShow: false,
Rubric: "Main Rubric",
ScoreBreakdown: [
{ Id: "q1", Name: "Scientific method", Score: "5" }
],
JudgeId: 9001,
JudgePublicId: "judge-public-guid",
JudgeName: "Sam Judge"
}]
}Field notes
- Round ids come from API Get Info →
Rounds. - On the get endpoint,
ClearOldScores: truewill clear the round scores before returning results — leave it false unless you intend to wipe scores. - Score breakdown is only returned when rubric detail data is available for the assessment.
Related APIs
- API Upload Judging Score
- API Set Judging Assignments
- API Get Judges / API Get Projects / API Get Info