Difference between revisions of "API Judging Scores"

From zFairs Contest Management
(Document score upload and JudgingScoresForRound get)
(Remove username/password API auth; ApiKey only)
 
Line 12: Line 12:
 
! Field !! Required !! Description
 
! Field !! Required !! Description
 
|-
 
|-
| <code>ApiKey</code> || Yes* || Private API key for your site. Prefer this over username/password.
+
| <code>ApiKey</code> || Yes || Private API key for your site.
|-
 
| <code>Username</code> / <code>Password</code> || Yes* || Alternate auth if not using ApiKey.
 
 
|-
 
|-
 
| <code>FairId</code> || Yes || Fair GUID from the site URL (<code>f</code> query parameter).
 
| <code>FairId</code> || Yes || Fair GUID from the site URL (<code>f</code> query parameter).
Line 21: Line 19:
 
|}
 
|}
  
* Provide '''either''' <code>ApiKey</code> '''or''' <code>Username</code>+<code>Password</code>.
 
  
 
Calls must be run '''server-side''' — do not expose your API key in a browser.
 
Calls must be run '''server-side''' — do not expose your API key in a browser.

Latest revision as of 12:55, 25 July 2026

Judging Scores

Two related endpoints:

  1. Upload scoresPOST /api/data/JudgingScores (also documented at API Upload Judging Score)
  2. Get scores for a roundPOST /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 InfoRounds.
  • On the get endpoint, ClearOldScores: true 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