API Get participants: Difference between revisions
From zFairs Contest Management
No edit summary |
Document full participant response for /api/data/participants |
||
| Line 1: | Line 1: | ||
== Get Participants == | == Get Participants == | ||
Returns all student/participant records for a fair, including project links, school/teacher, tags, waivers, and fee status when fees are tracked. | |||
=== 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. Prefer this over username/password. | |||
|- | |||
| <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>Body</code> || Depends || Request payload. Use <code>{}</code> when no body fields are needed. | |||
|} | |||
* 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. | |||
=== Response envelope === | |||
Most endpoints return: | |||
<pre> | |||
{ | |||
Success: true, | |||
Message: null, // error text when Success is false | |||
Body: { ... } // endpoint-specific payload | |||
} | |||
</pre> | |||
=== Request === | |||
<syntaxhighlight lang="JavaScript" line> | <syntaxhighlight lang="JavaScript" line> | ||
fetch('/api/data/participants', { | fetch('/api/data/participants', { | ||
method:'POST', | method:'POST', | ||
| Line 9: | Line 41: | ||
body: JSON.stringify({ | body: JSON.stringify({ | ||
ApiKey:'<Private key>', | ApiKey:'<Private key>', | ||
FairId: '9df61f13-474b-442f-ac1f-edca7348ef71', // | FairId: '9df61f13-474b-442f-ac1f-edca7348ef71', // value of f in your URL | ||
Body: {} | Body: {} | ||
}) | }) | ||
| Line 16: | Line 48: | ||
.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 === | |||
On success <code>Body</code> looks like: | |||
<syntaxhighlight lang="JavaScript"> | |||
{ | |||
Success: true, | |||
Message: null, | |||
Body: { | |||
participants: [{ | |||
id: "person-guid", | |||
idInt: 1001, | |||
firstName: "Alice", | |||
lastName: "Example", | |||
username: "alice.example", | |||
email: "alice@example.com", | |||
phone: "800-000-0000", | |||
address: "123 Main St", | |||
address2: "Apt 2", | |||
city: "Ogden", | |||
state: "UT", | |||
zip: "84401", | |||
countryName: "United States", | |||
projectId: "AB-123", // display project id | |||
projectKey: "36-char-GUID", // project GUID | |||
title: "Project Title", | |||
studentId: "S-001", | |||
divisionName: "Junior", | |||
category: { Id: "12", Name: "Biology" }, | |||
teamProject: true, | |||
school: { Id: "24", Name: "Example School" }, | |||
teacher: { Id: "55", Name: "Jane Smith" }, | |||
tags: ["VIP"], | |||
gender: "F", | |||
shirtSize: "M", | |||
holdHarmlessSigned: "2024-02-01T00:00:00Z", | |||
medialReleaseSigned: "2024-02-01T00:00:00Z", // note: field name is medialReleaseSigned | |||
mediaRelease: true, | |||
permissionsAndWaiversSigned: "2024-02-01T00:00:00Z", | |||
feePaid: true // null when the fair does not track registration fees | |||
}] | |||
} | |||
} | |||
</syntaxhighlight> | </syntaxhighlight> | ||
=== Field notes === | |||
* <code>feePaid</code> is only populated when the fair has a registration fee type configured; otherwise it is <code>null</code>. | |||
* Fee tracking can be by person or by project depending on fair settings. | |||
* <code>category</code>, <code>school</code>, and <code>teacher</code> use <code>{ Id, Name }</code>. | |||
* For project-scoped participants with flattened columns, see [[API Get Projects]]. | |||
=== Related APIs === | |||
* [[API Get Projects]] | |||
* [[API Add Person]] / [[API Add Project]] | |||
* [[API Get Teachers]] / [[API Get Schools]] | |||
* [[API Get Tags]] / [[API Set Tags]] | |||
<br/><br/> | |||
[[Category: API]] | [[Category: API]] | ||
Revision as of 11:49, 25 July 2026
Get Participants
Returns all student/participant records for a fair, including project links, school/teacher, tags, waivers, and fee status when fees are tracked.
Authentication
All data API calls are POST (unless noted) with JSON body:
| Field | Required | Description |
|---|---|---|
ApiKey |
Yes* | Private API key for your site. Prefer this over username/password. |
Username / Password |
Yes* | Alternate auth if not using ApiKey. |
FairId |
Yes | Fair GUID from the site URL (f query parameter).
|
Body |
Depends | Request payload. Use {} when no body fields are needed.
|
- Provide either
ApiKeyorUsername+Password.
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
}
Request
fetch('/api/data/participants', {
method:'POST',
headers:{'Content-Type': 'application/json'},
body: JSON.stringify({
ApiKey:'<Private key>',
FairId: '9df61f13-474b-442f-ac1f-edca7348ef71', // value of f in your URL
Body: {}
})
})
.then(response => response.json())
.then(data=>{console.log('Success: ',data);})
.catch((error)=>{console.log('Error: ', error);});Response
On success Body looks like:
{
Success: true,
Message: null,
Body: {
participants: [{
id: "person-guid",
idInt: 1001,
firstName: "Alice",
lastName: "Example",
username: "alice.example",
email: "alice@example.com",
phone: "800-000-0000",
address: "123 Main St",
address2: "Apt 2",
city: "Ogden",
state: "UT",
zip: "84401",
countryName: "United States",
projectId: "AB-123", // display project id
projectKey: "36-char-GUID", // project GUID
title: "Project Title",
studentId: "S-001",
divisionName: "Junior",
category: { Id: "12", Name: "Biology" },
teamProject: true,
school: { Id: "24", Name: "Example School" },
teacher: { Id: "55", Name: "Jane Smith" },
tags: ["VIP"],
gender: "F",
shirtSize: "M",
holdHarmlessSigned: "2024-02-01T00:00:00Z",
medialReleaseSigned: "2024-02-01T00:00:00Z", // note: field name is medialReleaseSigned
mediaRelease: true,
permissionsAndWaiversSigned: "2024-02-01T00:00:00Z",
feePaid: true // null when the fair does not track registration fees
}]
}
}
Field notes
feePaidis only populated when the fair has a registration fee type configured; otherwise it isnull.- Fee tracking can be by person or by project depending on fair settings.
category,school, andteacheruse{ Id, Name }.- For project-scoped participants with flattened columns, see API Get Projects.
Related APIs
- API Get Projects
- API Add Person / API Add Project
- API Get Teachers / API Get Schools
- API Get Tags / API Set Tags