Household and participant forms
Each organization designs its own forms in Trax. The API serves them to signed-in families:
- the household form, which a family fills in before registering;
- the participant form, filled in for each household member;
- activity forms, which some activities ask for at checkout.
Activity forms are answered in the checkout forms step (cart and checkout guide); this guide covers reading them and the signature element they can share with the participant form.
The server picks the form. You never send a form id. The API serves the form the organization set up for this
portal. Each save is checked on the server and writes only the fields you send. A portal without a household form
answers 404 form-not-configured, and its households don't need to verify before registering.
The form
The household form
GET https://api.nfocus.solutions/v1/portals/riverbend/north/forms/household → 200 OK, JSON
curl
curl -s 'https://api.nfocus.solutions/v1/portals/riverbend/north/forms/household' \
-H 'Authorization: Bearer your_access_token'JavaScript
const response = await fetch('https://api.nfocus.solutions/v1/portals/riverbend/north/forms/household', {
headers: {
'Authorization': 'Bearer your_access_token',
},
});
const data = await response.json();C#
using var http = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Get, "https://api.nfocus.solutions/v1/portals/riverbend/north/forms/household");
request.Headers.Authorization = new("Bearer", "your_access_token");
using var response = await http.SendAsync(request);
var json = await response.Content.ReadAsStringAsync();GET …/forms/household and GET …/forms/participant return the form as staff designed it:
| Part | Meaning |
|---|---|
formId, title |
The form |
definitionHash |
Changes whenever staff edit the form. Send it back with a save to catch edits made in between |
rows[].columns[] |
The layout: each column has a width and either an element or more rows |
Each element is a field, a collection or a static element.
Fields have a key:
- Element types:
text-box,text-area,number,decimal,date,date-time,time,check-box,contact-number(a phone), the single-choice listslist-radio,list-radioflow,list-dropdown,list-static, and the several-choice listslist-checkbox,list-checkboxflow,list-checkboxdropdown(multiple: true). - What to show:
label,required,maxLength,minLength,min,max,step,isDob,options(eachvalueandtext),columnCount,listType,lines. readOnly: shown, never saved.writeOnly: the SSN, shown masked. Send a new value to replace it.
Collections (type: "collection") hold repeated entries: addresses, phones, emails, school records, contacts,
household members, household contacts, and custom data records:
itemis the layout of one entry, with its own fields. A contact's phone or email is onephone-emailelement naming its type field (typeKey,typeOptions).requiredWhenon an item field: that field becomes required once any field it names has a value (for example, a city once the street is entered).singleItem: true: one entry at most.allowAdd: false: no new entries (household members: a form never adds or removes a member).allowEdit: false: stored entries can't be changed.allowRemove: false: stored entries can't be removed.
Static elements have no key: header (text), editor (staff html, already sanitized), horizontal-divider,
blank and pagebreak (a print hint; forms are one page).
Signatures (type: "signature") appear only where the organization uses electronic signatures; elsewhere they
are left out and never required, as in the current portal. Each has:
signatureId: send the signature back with this id;required,signeeRole(who signs, such as "Parent/Guardian": show "Signature (Parent/Guardian)");showPrintedNameandshowDate: what to show under the signature;usageDescription: what staff said the signature is for.
Elements the API doesn't serve (military, work history, education history, references and staff-only fields) are left
out. A form that needs one of them answers 409 form-not-renderable.
What the keys hold
| Keys | What they hold |
|---|---|
person.*, participant.* |
The member: name, birth date, gender, ethnicity, race, SSN, languages, disabilities, medical fields, sizes, education, the pickup password and program flags |
person.identification.{id} |
One of the organization's identification fields (a student ID, for example) |
person.addresses, person.phoneNumbers, person.emailAddresses |
The member's addresses, phones and emails |
participant.schoolRecord |
School records at this organization (each needs its school) |
participant.contacts |
Contacts: people with emergency, pickup and must-not-pick-up flags, one primary emergency contact. New entries become new people |
household.* |
The household and its head: household details, the head's name, flags, addresses, phones and emails |
household.contacts |
The other household members (edited only) |
household.hhContacts |
Contacts who aren't members. New entries become new people; removing one removes the link |
dynamic.{dataSetId} |
Records of one of the organization's custom data sets; entry fields are named after its attributes |
An activity's form
An activity's form
GET https://api.nfocus.solutions/v1/portals/riverbend/north/activities/7/form → 200 OK, JSON
curl
curl -s 'https://api.nfocus.solutions/v1/portals/riverbend/north/activities/7/form' \
-H 'Authorization: Bearer your_access_token'JavaScript
const response = await fetch('https://api.nfocus.solutions/v1/portals/riverbend/north/activities/7/form', {
headers: {
'Authorization': 'Bearer your_access_token',
},
});
const data = await response.json();C#
using var http = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Get, "https://api.nfocus.solutions/v1/portals/riverbend/north/activities/7/form");
request.Headers.Authorization = new("Bearer", "your_access_token");
using var response = await http.SendAsync(request);
var json = await response.Content.ReadAsStringAsync();GET …/activities/{activityId}/form returns the activity's form when it has one, or 404 form-not-configured.
Its fields are participant-form fields (person.*, participant.*, dynamic.*). Families answer them for each
member registering, in the checkout forms step (see "Forms and waivers" in the cart and checkout guide).
Answers
The household's answers
GET https://api.nfocus.solutions/v1/portals/riverbend/north/forms/household/answers → 200 OK, JSON
curl
curl -s 'https://api.nfocus.solutions/v1/portals/riverbend/north/forms/household/answers' \
-H 'Authorization: Bearer your_access_token'JavaScript
const response = await fetch('https://api.nfocus.solutions/v1/portals/riverbend/north/forms/household/answers', {
headers: {
'Authorization': 'Bearer your_access_token',
},
});
const data = await response.json();C#
using var http = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Get, "https://api.nfocus.solutions/v1/portals/riverbend/north/forms/household/answers");
request.Headers.Authorization = new("Bearer", "your_access_token");
using var response = await http.SendAsync(request);
var json = await response.Content.ReadAsStringAsync();GET …/forms/household/answers and GET …/forms/participant/people/{personId} return what is stored. Only the
fields on the form are returned, keyed by field key:
| Kind | Value |
|---|---|
| Text, list choices | A string. List values are the options' value |
| Numbers | A number |
| Dates | YYYY-MM-DD |
| Dates with times, times | YYYY-MM-DDTHH:MM, HH:MM |
| Check boxes | true or false |
| Several choices | A list of option values |
| Phones | { "number", "extension", "formatted" } |
| Collections | A list of entries, each with id, isPrimary and its fields |
| SSN | *****1234, never the full number |
The participant form is for a member of the signed-in family's household; anyone else answers
404 member-not-found.
Saving
PUT the same path with the answers:
{
"definitionHash": "…",
"answers": {
"household.familySize": 4,
"household.addresses": [{ "id": 120, "address1": "22 Synthetic Lane", "isPrimary": true }],
"household.phoneNumbers": [{ "id": 98 }, { "phoneType": "3", "phone": { "number": "555-201-0099" } }]
}
}
What a save changes:
- A field left out keeps its stored value; one sent empty (
""ornull) is cleared. - Collections:
- A collection left out is untouched.
- Otherwise send its full list: entries with an
idare updated, entries without one are added, and stored entries missing from the list are removed.[]removes them all. - Fields left out of an entry keep their value. Entry field names match without regard to case.
- An entry's
idmust be one this form returned for this person. - A custom data record keeps the attributes the form doesn't show.
- Mark one entry
isPrimaryto make it the primary address, phone or email. - For the SSN, send the masked value back unchanged, leave it out, or send all nine digits to replace it.
- A participant form can't be saved here while the member has answers waiting in the checkout forms step
(
409 member-in-checkout); checkout saves those answers.
Signatures
Draw signatures with Signature Pad 4.x and send, for each one signed:
"signatures": [
{ "signatureId": "00000000-0000-4000-8000-000000000508", "printedName": "Pat Example", "strokes": [ … ] }
]
strokesissignaturePad.toData()as it is: each stroke's pen settings and its points (x,yin pixels on the pad,pressure,time). At least 10 points; the signer types their name inprintedName(up to 128 characters).- The server checks each signature, stamps the time it received it and takes the role and usage from the form. It never takes a time, a role or a picture from the browser.
- On the participant form, a save with a signature also files a PDF of the form, drawn on the server from the answers,
as a signed document. The answer's
documentIdnames it, and it appears with the member's documents. A save without a signature files nothing. Each signed save adds a document; earlier ones stay. 503 documents-unavailable: the PDF couldn't be made just now, so nothing was saved. Try again.
A participant-form save naming a signature the form doesn't have
PUT https://api.nfocus.solutions/v1/portals/riverbend/north/forms/participant/people/1234 → 400, problem details
curl
curl -s -X PUT 'https://api.nfocus.solutions/v1/portals/riverbend/north/forms/participant/people/1234' \
-H 'Authorization: Bearer your_access_token' \
-H 'Content-Type: application/json' \
-d '{"answers": {}, "signatures": [{"signatureId": "not-on-this-form", "printedName": "Pat Example", "strokes": []}]}'JavaScript
const response = await fetch('https://api.nfocus.solutions/v1/portals/riverbend/north/forms/participant/people/1234', {
method: 'PUT',
headers: {
'Authorization': 'Bearer your_access_token',
'Content-Type': 'application/json',
},
body: JSON.stringify({"answers": {}, "signatures": [{"signatureId": "not-on-this-form", "printedName": "Pat Example", "strokes": []}]}),
});
const data = await response.json();C#
using var http = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Put, "https://api.nfocus.solutions/v1/portals/riverbend/north/forms/participant/people/1234");
request.Headers.Authorization = new("Bearer", "your_access_token");
request.Content = new StringContent("""
{"answers": {}, "signatures": [{"signatureId": "not-on-this-form", "printedName": "Pat Example", "strokes": []}]}
""", System.Text.Encoding.UTF8, "application/json");
using var response = await http.SendAsync(request);
var json = await response.Content.ReadAsStringAsync();A save with answers the form refuses
PUT https://api.nfocus.solutions/v1/portals/riverbend/north/forms/household/answers → 422, problem details
curl
curl -s -X PUT 'https://api.nfocus.solutions/v1/portals/riverbend/north/forms/household/answers' \
-H 'Authorization: Bearer your_access_token' \
-H 'Content-Type: application/json' \
-d '{"answers": {"household.familySize": 0, "household.firstname": ""}}'JavaScript
const response = await fetch('https://api.nfocus.solutions/v1/portals/riverbend/north/forms/household/answers', {
method: 'PUT',
headers: {
'Authorization': 'Bearer your_access_token',
'Content-Type': 'application/json',
},
body: JSON.stringify({"answers": {"household.familySize": 0, "household.firstname": ""}}),
});
const data = await response.json();C#
using var http = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Put, "https://api.nfocus.solutions/v1/portals/riverbend/north/forms/household/answers");
request.Headers.Authorization = new("Bearer", "your_access_token");
request.Content = new StringContent("""
{"answers": {"household.familySize": 0, "household.firstname": ""}}
""", System.Text.Encoding.UTF8, "application/json");
using var response = await http.SendAsync(request);
var json = await response.Content.ReadAsStringAsync();Refused saves:
422 invalid-answerslists every problem by key, entries included (household.addresses[0].city). Nothing is written. The checks are:- required fields;
- lengths;
- whole numbers and limits;
- dates (a birth date before today);
- phone numbers (as the organization checks them);
- email addresses;
- list values;
- fields that aren't on the form.
409 form-changed: thedefinitionHashyou sent is no longer current. Load the form again.400for a signature that isn't on the form, a blankprintedNameor strokes that aren't Signature Pad's (signatures[0].strokes). A required signature left out is a422error undersignatures.{signatureId}.
A valid household save marks the household verified, so its members can register (Household and eligibility guide).
The answer to a save is the stored answers, as the GET returns them.
What changed from the current portal
- The server checks every answer; the current portal checked nothing and saved what the browser sent.
- Only the fields on the form are shown or saved. The current portal returned the whole record, full SSN included, and its saves reset fields the form didn't show (insurance, swimming, disabilities, household notes, the head's "lives in" flag) and replaced custom data records whole.
- The person, household and every entry must be the family's own.
- The current portal printed the browser's own page as the signed PDF and took the signature's time, role and usage from the browser. The API builds the PDF from the saved answers and takes those from the server and the form; it never fetches anything while printing.