[{"data":1,"prerenderedAt":3586},["ShallowReactive",2],{"api-nav":3,"api-guide:\u002Fapi\u002Fguides\u002Freference-data":351,"api-spec:guide:\u002Fapi\u002Fguides\u002Freference-data":3566},[4,28,57,95,115,301,317,331],{"id":5,"title":6,"links":7,"groups":27},"start","Start here",[8,11,15,18,21,24],{"title":9,"to":10},"Overview","\u002Fapi",{"title":12,"to":13,"status":14},"Quickstart","\u002Fapi\u002Fquickstart","available",{"title":16,"to":17,"status":14},"Environments","\u002Fapi\u002Fenvironments",{"title":19,"to":20,"status":14},"Authentication","\u002Fapi\u002Fauthentication",{"title":22,"to":23,"status":14},"Organizations","\u002Fapi\u002Forganizations",{"title":25,"to":26,"status":14},"Permissions","\u002Fapi\u002Fpermissions",[],{"id":29,"title":30,"links":31,"groups":56},"concepts","Concepts",[32,35,38,41,44,47,50,53],{"title":33,"to":34,"status":14},"Requests and responses","\u002Fapi\u002Frequests-and-responses",{"title":36,"to":37,"status":14},"Identifiers","\u002Fapi\u002Fidentifiers",{"title":39,"to":40,"status":14},"Pagination","\u002Fapi\u002Fpagination",{"title":42,"to":43},"Errors","\u002Fapi\u002Ferrors",{"title":45,"to":46,"status":14},"Rate limits","\u002Fapi\u002Frate-limits",{"title":48,"to":49,"status":14},"Retries","\u002Fapi\u002Fretries-and-idempotency",{"title":51,"to":52,"status":14},"Security","\u002Fapi\u002Fsecurity",{"title":54,"to":55,"status":14},"Versioning","\u002Fapi\u002Fversioning",[],{"id":58,"title":59,"links":60,"groups":94},"resources","Guides",[61,64,67,70,73,76,79,82,85,88,91],{"title":62,"to":63,"status":14},"Students","\u002Fapi\u002Fguides\u002Fstudents",{"title":65,"to":66,"status":14},"Bulk registration","\u002Fapi\u002Fguides\u002Fbulk-registration",{"title":68,"to":69,"status":14},"Passwords","\u002Fapi\u002Fguides\u002Fpasswords",{"title":71,"to":72,"status":14},"Supervisors","\u002Fapi\u002Fguides\u002Fsupervisors",{"title":74,"to":75,"status":14},"Reference data","\u002Fapi\u002Fguides\u002Freference-data",{"title":77,"to":78,"status":14},"API account","\u002Fapi\u002Fguides\u002Fapi-account",{"title":80,"to":81,"status":14},"Sign-in links","\u002Fapi\u002Fguides\u002Fsign-in-links",{"title":83,"to":84,"status":14},"Exams","\u002Fapi\u002Fguides\u002Fexams",{"title":86,"to":87,"status":14},"Applications","\u002Fapi\u002Fguides\u002Fapplications",{"title":89,"to":90,"status":14},"Group challenges","\u002Fapi\u002Fguides\u002Fgroup-challenges",{"title":92,"to":93,"status":14},"Certificates and reports","\u002Fapi\u002Fguides\u002Fcertificates-and-reports",[],{"id":96,"title":97,"links":98,"groups":114},"tutorials","Tutorials",[99,102,105,108,111],{"title":100,"to":101,"status":14},"Register and apply","\u002Fapi\u002Ftutorials\u002Fregister-and-apply",{"title":103,"to":104,"status":14},"Send a student to the panel","\u002Fapi\u002Ftutorials\u002Fsend-student-to-panel",{"title":106,"to":107,"status":14},"Change an application","\u002Fapi\u002Ftutorials\u002Fchange-an-application",{"title":109,"to":110,"status":14},"Collect results","\u002Fapi\u002Ftutorials\u002Fcollect-results",{"title":112,"to":113,"status":14},"Token handling","\u002Fapi\u002Ftutorials\u002Ftoken-handling",[],{"id":116,"title":117,"links":118,"groups":125},"reference","Reference",[119,122],{"title":120,"to":121},"All endpoints","\u002Fapi\u002Freference",{"title":123,"to":124},"Sandbox console","\u002Fapi\u002Fconsole",[126,135,145,166,206,212,230,255,271],{"tag":127,"slug":128,"links":129},"Health","health",[130],{"title":131,"to":132,"method":133,"deprecated":134},"Check that the API is up","\u002Fapi\u002Freference\u002Fget-health","GET",false,{"tag":77,"slug":136,"links":137},"api-account",[138,142],{"title":139,"to":140,"method":141,"deprecated":134},"Revoke the token you send, before it expires","\u002Fapi\u002Freference\u002Frevoke-token","POST",{"title":143,"to":144,"method":133,"deprecated":134},"Fetch the API account your token belongs to","\u002Fapi\u002Freference\u002Fget-current-api-account",{"tag":74,"slug":146,"links":147},"reference-data",[148,151,154,157,160,163],{"title":149,"to":150,"method":133,"deprecated":134},"List the countries a student can be registered in","\u002Fapi\u002Freference\u002Flist-countries",{"title":152,"to":153,"method":133,"deprecated":134},"Fetch one country by its id","\u002Fapi\u002Freference\u002Fget-country",{"title":155,"to":156,"method":133,"deprecated":134},"List the grades a student can be registered with","\u002Fapi\u002Freference\u002Flist-grades",{"title":158,"to":159,"method":133,"deprecated":134},"Fetch one grade by its id","\u002Fapi\u002Freference\u002Fget-grade",{"title":161,"to":162,"method":133,"deprecated":134},"List the organizations and their ids","\u002Fapi\u002Freference\u002Flist-organizations",{"title":164,"to":165,"method":133,"deprecated":134},"Fetch one organization by its id","\u002Fapi\u002Freference\u002Fget-organization",{"tag":62,"slug":167,"links":168},"students",[169,172,175,178,181,184,187,191,194,197,200,203],{"title":170,"to":171,"method":133,"deprecated":134},"List your students","\u002Fapi\u002Freference\u002Flist-students",{"title":173,"to":174,"method":141,"deprecated":134},"Register a student","\u002Fapi\u002Freference\u002Fregister-student",{"title":176,"to":177,"method":141,"deprecated":134},"Check a registration without registering the student","\u002Fapi\u002Freference\u002Fcheck-student-registration",{"title":179,"to":180,"method":141,"deprecated":134},"Register many students at once","\u002Fapi\u002Freference\u002Fcreate-student-import",{"title":182,"to":183,"method":133,"deprecated":134},"Follow a batch of students you sent","\u002Fapi\u002Freference\u002Fget-student-import",{"title":185,"to":186,"method":133,"deprecated":134},"Fetch one of your students","\u002Fapi\u002Freference\u002Fget-student",{"title":188,"to":189,"method":190,"deprecated":134},"Update one of your students","\u002Fapi\u002Freference\u002Fupdate-student","PUT",{"title":192,"to":193,"method":190,"deprecated":134},"Set the sign-in password of one of your students","\u002Fapi\u002Freference\u002Fset-student-password",{"title":195,"to":196,"method":133,"deprecated":134},"List your students who can use this organization","\u002Fapi\u002Freference\u002Flist-org-students",{"title":198,"to":199,"method":133,"deprecated":134},"Fetch one of your students, if they can use this organization","\u002Fapi\u002Freference\u002Fget-org-student",{"title":201,"to":202,"method":190,"deprecated":134},"Update one of your students and give them access to this organization","\u002Fapi\u002Freference\u002Fupdate-org-student",{"title":204,"to":205,"method":190,"deprecated":134},"Link one of your students to a supervisor on this organization","\u002Fapi\u002Freference\u002Flink-student-supervisor",{"tag":80,"slug":207,"links":208},"sign-in-links",[209],{"title":210,"to":211,"method":141,"deprecated":134},"Create a single-use sign-in link for one of your students","\u002Fapi\u002Freference\u002Fcreate-signin-link",{"tag":83,"slug":213,"links":214},"exams",[215,218,221,224,227],{"title":216,"to":217,"method":133,"deprecated":134},"List the exams open for applications","\u002Fapi\u002Freference\u002Flist-exams",{"title":219,"to":220,"method":133,"deprecated":134},"List an organization’s exam categories","\u002Fapi\u002Freference\u002Flist-exam-categories",{"title":222,"to":223,"method":133,"deprecated":134},"Fetch one exam category","\u002Fapi\u002Freference\u002Fget-exam-category",{"title":225,"to":226,"method":133,"deprecated":134},"List the exams one of your students can apply to","\u002Fapi\u002Freference\u002Flist-available-exams",{"title":228,"to":229,"method":133,"deprecated":134},"Fetch one exam that is open for applications","\u002Fapi\u002Freference\u002Fget-exam",{"tag":86,"slug":231,"links":232},"applications",[233,236,239,242,245,248,251],{"title":234,"to":235,"method":133,"deprecated":134},"List your students’ applications in this organization","\u002Fapi\u002Freference\u002Flist-applications",{"title":237,"to":238,"method":141,"deprecated":134},"Enter one of your students for an exam","\u002Fapi\u002Freference\u002Fcreate-application",{"title":240,"to":241,"method":133,"deprecated":134},"List your students’ applications for one exam","\u002Fapi\u002Freference\u002Flist-exam-applications",{"title":243,"to":244,"method":133,"deprecated":134},"List one of your students’ applications in this organization","\u002Fapi\u002Freference\u002Flist-student-applications",{"title":246,"to":247,"method":133,"deprecated":134},"Fetch one of your students’ applications","\u002Fapi\u002Freference\u002Fget-application",{"title":249,"to":250,"method":190,"deprecated":134},"Move one of your students’ applications to another exam","\u002Fapi\u002Freference\u002Fmove-application",{"title":252,"to":253,"method":254,"deprecated":134},"Withdraw one of your students from an exam","\u002Fapi\u002Freference\u002Fdelete-application","DELETE",{"tag":256,"slug":257,"links":258},"Documents","documents",[259,262,265,268],{"title":260,"to":261,"method":133,"deprecated":134},"Download a certificate file","\u002Fapi\u002Freference\u002Fdownload-certificate",{"title":263,"to":264,"method":133,"deprecated":134},"List one of your students’ released certificates","\u002Fapi\u002Freference\u002Flist-student-certificates",{"title":266,"to":267,"method":133,"deprecated":134},"Download a result report file","\u002Fapi\u002Freference\u002Fdownload-report",{"title":269,"to":270,"method":133,"deprecated":134},"List one of your students’ released result reports","\u002Fapi\u002Freference\u002Flist-student-reports",{"tag":89,"slug":272,"links":273},"group-challenges",[274,277,280,283,286,289,292,295,298],{"title":275,"to":276,"method":133,"deprecated":134},"List the group challenges an organization runs","\u002Fapi\u002Freference\u002Flist-group-challenges",{"title":278,"to":279,"method":133,"deprecated":134},"Fetch one group challenge","\u002Fapi\u002Freference\u002Fget-group-challenge",{"title":281,"to":282,"method":133,"deprecated":134},"List the groups your students are in for a group challenge","\u002Fapi\u002Freference\u002Flist-group-challenge-groups",{"title":284,"to":285,"method":133,"deprecated":134},"Fetch one group, with its steps and files","\u002Fapi\u002Freference\u002Fget-group-challenge-group",{"title":287,"to":288,"method":133,"deprecated":134},"List what has happened in one group","\u002Fapi\u002Freference\u002Flist-group-challenge-activity",{"title":290,"to":291,"method":141,"deprecated":134},"Send a group’s finished work for one of your students","\u002Fapi\u002Freference\u002Fsubmit-group-challenge-work",{"title":293,"to":294,"method":141,"deprecated":134},"Submit one step of a group for one of your students","\u002Fapi\u002Freference\u002Fsubmit-group-challenge-step",{"title":296,"to":297,"method":133,"deprecated":134},"List your students’ eligibility and groups for a group challenge","\u002Fapi\u002Freference\u002Flist-group-challenge-students",{"title":299,"to":300,"method":133,"deprecated":134},"Fetch one of your students’ eligibility and group for a group challenge","\u002Fapi\u002Freference\u002Fget-group-challenge-student",{"id":302,"title":303,"links":304,"groups":316},"clients","Clients",[305,307,310,313],{"title":9,"to":306,"status":14},"\u002Fapi\u002Fclients",{"title":308,"to":309,"status":14},"Node.js","\u002Fapi\u002Fclients\u002Fnode",{"title":311,"to":312,"status":14},"PHP","\u002Fapi\u002Fclients\u002Fphp",{"title":314,"to":315,"status":14},"Build your own","\u002Fapi\u002Fclients\u002Fbuild-your-own",[],{"id":318,"title":319,"links":320,"groups":330},"agents","AI agents",[321,324,327],{"title":322,"to":323},"AI connections","\u002Fapi\u002Fmcp",{"title":325,"to":326},"What it can do","\u002Fapi\u002Fmcp\u002Ftools",{"title":328,"to":329},"Agent skills","\u002Fapi\u002Fskills",[],{"id":332,"title":333,"links":334,"groups":350},"help","Help",[335,338,341,344,347],{"title":336,"to":337,"status":14},"Glossary","\u002Fapi\u002Fglossary",{"title":339,"to":340,"status":14},"FAQ","\u002Fapi\u002Ffaq",{"title":342,"to":343,"status":14},"Troubleshooting","\u002Fapi\u002Ftroubleshooting",{"title":345,"to":346,"status":14},"Support","\u002Fapi\u002Fsupport",{"title":348,"to":349},"Changelog","\u002Fapi\u002Fchangelog",[],{"id":352,"title":74,"body":353,"description":3552,"extension":3553,"meta":3554,"navTitle":74,"navigation":2464,"operations":3555,"order":3562,"path":75,"section":58,"seo":3563,"status":14,"stem":3564,"__hash__":3565},"apiGuides\u002Fapi\u002Fguides\u002Freference-data.md",{"type":354,"value":355,"toc":3527},"minimark",[356,360,451,459,463,480,539,560,563,567,610,888,905,1010,1017,1038,1042,1066,1176,1183,1207,1210,1213,1237,1420,1432,1482,1486,1495,1499,1529,1533,1557,1639,1642,1645,1669,1890,1908,1911,2030,2037,2067,2137,2151,2155,2179,2285,2289,2354,2377,2381,2398,2402,2409,2429,2436,2933,3480,3490,3494,3523],[357,358,359],"p",{},"Three read-only directories supply the ids the rest of the API asks for:",[361,362,363,379],"table",{},[364,365,366],"thead",{},[367,368,369,373,376],"tr",{},[370,371,372],"th",{},"Directory",[370,374,375],{},"What you use it for",[370,377,378],{},"Operations",[380,381,382,410,429],"tbody",{},[367,383,384,388,401],{},[385,386,387],"td",{},"Countries",[385,389,390,391,395,396],{},"The ",[392,393,394],"code",{},"country"," field when you ",[397,398,400],"a",{"href":399},"\u002Fapi\u002Fguides\u002Fstudents#register-a-student","register a student",[385,402,403,406,407],{},[397,404,405],{"href":150},"List countries",", ",[397,408,409],{"href":153},"Get a country",[367,411,412,415,421],{},[385,413,414],{},"Grades",[385,416,390,417,420],{},[392,418,419],{},"grade"," field at registration, and the grade an exam is restricted to",[385,422,423,406,426],{},[397,424,425],{"href":156},"List grades",[397,427,428],{"href":159},"Get a grade",[367,430,431,433,443],{},[385,432,22],{},[385,434,390,435,438,439,442],{},[392,436,437],{},"\u003CorganizationId>"," in every ",[392,440,441],{},"\u002Fv1\u002F\u003CorganizationId>\u002F…"," path",[385,444,445,406,448],{},[397,446,447],{"href":162},"List organizations",[397,449,450],{"href":165},"Get an organization",[357,452,453,454,458],{},"The API never creates, changes or deletes reference data. Each of these routes is a plain read, and\nnothing you send to any other route adds a country, grade, city or school. A value that matches\nnothing is refused (see ",[397,455,457],{"href":456},"\u002Fapi\u002Fguides\u002Fstudents#how-reference-fields-resolve","How reference fields resolve",").",[460,461,25],"h2",{"id":462},"permissions",[357,464,465,466,468,469,472,473,475,476,479],{},"All six routes are flat routes: they have no ",[392,467,437],{}," in the path, so they act on the core\nrecord (",[392,470,471],{},"mto","). A role that grants one needs target ",[392,474,471],{}," or ",[392,477,478],{},"*",".",[361,481,482,492],{},[364,483,484],{},[367,485,486,489],{},[370,487,488],{},"Route",[370,490,491],{},"Permission",[380,493,494,509,524],{},[367,495,496,504],{},[385,497,498,406,501],{},[392,499,500],{},"GET \u002Fv1\u002Fcountry",[392,502,503],{},"GET \u002Fv1\u002Fcountry\u002F\u003Cid>",[385,505,506],{},[392,507,508],{},"country\u002Fread",[367,510,511,519],{},[385,512,513,406,516],{},[392,514,515],{},"GET \u002Fv1\u002Fgrade",[392,517,518],{},"GET \u002Fv1\u002Fgrade\u002F\u003Cid>",[385,520,521],{},[392,522,523],{},"grade\u002Fread",[367,525,526,534],{},[385,527,528,406,531],{},[392,529,530],{},"GET \u002Fv1\u002Forganization",[392,532,533],{},"GET \u002Fv1\u002Forganization\u002F\u003Cid>",[385,535,536],{},[392,537,538],{},"organization\u002Fread",[357,540,541,542,545,546,552,553,556,557,559],{},"Without the permission the answer is ",[392,543,544],{},"403"," with code ",[397,547,549],{"href":548},"\u002Fapi\u002Ferrors#forbidden",[392,550,551],{},"forbidden"," and the message\n",[392,554,555],{},"Insufficient role permissions",". The ",[397,558,25],{"href":26}," page explains how roles match.",[460,561,387],{"id":562},"countries",[564,565,405],"h3",{"id":566},"list-countries",[568,569,574],"pre",{"className":570,"code":571,"language":572,"meta":573,"style":573},"language-bash shiki shiki-themes github-light-high-contrast github-dark-high-contrast","curl \"https:\u002F\u002Fapi.main-team.org\u002Fv1\u002Fcountry?page=1&limit=100\" \\\n  -H \"Authorization: Bearer $TOKEN\"\n","bash","",[392,575,576,593],{"__ignoreMap":573},[577,578,581,585,589],"span",{"class":579,"line":580},"line",1,[577,582,584],{"class":583},"soyes","curl",[577,586,588],{"class":587},"sT6z2"," \"https:\u002F\u002Fapi.main-team.org\u002Fv1\u002Fcountry?page=1&limit=100\"",[577,590,592],{"class":591},"sHUrx"," \\\n",[577,594,596,600,603,607],{"class":579,"line":595},2,[577,597,599],{"class":598},"s-5SL","  -H",[577,601,602],{"class":587}," \"Authorization: Bearer ",[577,604,606],{"class":605},"suds8","$TOKEN",[577,608,609],{"class":587},"\"\n",[568,611,615],{"className":612,"code":613,"language":614,"meta":573,"style":573},"language-json shiki shiki-themes github-light-high-contrast github-dark-high-contrast","{\n  \"success\": true,\n  \"message\": \"Countries fetched successfully.\",\n  \"data\": [\n    {\n      \"_id\": \"630e0182c53dc79a6836e67e\",\n      \"name\": \"GERMANY\",\n      \"iso2\": \"DE\",\n      \"iso3\": \"DEU\",\n      \"createdAt\": \"2022-08-30T12:14:26.118Z\",\n      \"updatedAt\": \"2022-08-30T12:14:26.118Z\"\n    },\n    {\n      \"_id\": \"630e0182c53dc79a6836e67f\",\n      \"name\": \"ALGERIA\",\n      \"iso2\": \"DZ\",\n      \"iso3\": \"DZA\",\n      \"createdAt\": \"2022-08-30T12:14:26.118Z\",\n      \"updatedAt\": \"2022-08-30T12:14:26.118Z\"\n    }\n  ],\n  \"pagination\": { \"page\": 1, \"limit\": 100, \"total\": 246, \"totalPages\": 3 }\n}\n","json",[392,616,617,622,637,650,659,665,678,691,704,717,730,741,747,752,764,776,788,800,811,820,826,832,882],{"__ignoreMap":573},[577,618,619],{"class":579,"line":580},[577,620,621],{"class":605},"{\n",[577,623,624,628,631,634],{"class":579,"line":595},[577,625,627],{"class":626},"sne4z","  \"success\"",[577,629,630],{"class":605},": ",[577,632,633],{"class":598},"true",[577,635,636],{"class":605},",\n",[577,638,640,643,645,648],{"class":579,"line":639},3,[577,641,642],{"class":626},"  \"message\"",[577,644,630],{"class":605},[577,646,647],{"class":587},"\"Countries fetched successfully.\"",[577,649,636],{"class":605},[577,651,653,656],{"class":579,"line":652},4,[577,654,655],{"class":626},"  \"data\"",[577,657,658],{"class":605},": [\n",[577,660,662],{"class":579,"line":661},5,[577,663,664],{"class":605},"    {\n",[577,666,668,671,673,676],{"class":579,"line":667},6,[577,669,670],{"class":626},"      \"_id\"",[577,672,630],{"class":605},[577,674,675],{"class":587},"\"630e0182c53dc79a6836e67e\"",[577,677,636],{"class":605},[577,679,681,684,686,689],{"class":579,"line":680},7,[577,682,683],{"class":626},"      \"name\"",[577,685,630],{"class":605},[577,687,688],{"class":587},"\"GERMANY\"",[577,690,636],{"class":605},[577,692,694,697,699,702],{"class":579,"line":693},8,[577,695,696],{"class":626},"      \"iso2\"",[577,698,630],{"class":605},[577,700,701],{"class":587},"\"DE\"",[577,703,636],{"class":605},[577,705,707,710,712,715],{"class":579,"line":706},9,[577,708,709],{"class":626},"      \"iso3\"",[577,711,630],{"class":605},[577,713,714],{"class":587},"\"DEU\"",[577,716,636],{"class":605},[577,718,720,723,725,728],{"class":579,"line":719},10,[577,721,722],{"class":626},"      \"createdAt\"",[577,724,630],{"class":605},[577,726,727],{"class":587},"\"2022-08-30T12:14:26.118Z\"",[577,729,636],{"class":605},[577,731,733,736,738],{"class":579,"line":732},11,[577,734,735],{"class":626},"      \"updatedAt\"",[577,737,630],{"class":605},[577,739,740],{"class":587},"\"2022-08-30T12:14:26.118Z\"\n",[577,742,744],{"class":579,"line":743},12,[577,745,746],{"class":605},"    },\n",[577,748,750],{"class":579,"line":749},13,[577,751,664],{"class":605},[577,753,755,757,759,762],{"class":579,"line":754},14,[577,756,670],{"class":626},[577,758,630],{"class":605},[577,760,761],{"class":587},"\"630e0182c53dc79a6836e67f\"",[577,763,636],{"class":605},[577,765,767,769,771,774],{"class":579,"line":766},15,[577,768,683],{"class":626},[577,770,630],{"class":605},[577,772,773],{"class":587},"\"ALGERIA\"",[577,775,636],{"class":605},[577,777,779,781,783,786],{"class":579,"line":778},16,[577,780,696],{"class":626},[577,782,630],{"class":605},[577,784,785],{"class":587},"\"DZ\"",[577,787,636],{"class":605},[577,789,791,793,795,798],{"class":579,"line":790},17,[577,792,709],{"class":626},[577,794,630],{"class":605},[577,796,797],{"class":587},"\"DZA\"",[577,799,636],{"class":605},[577,801,803,805,807,809],{"class":579,"line":802},18,[577,804,722],{"class":626},[577,806,630],{"class":605},[577,808,727],{"class":587},[577,810,636],{"class":605},[577,812,814,816,818],{"class":579,"line":813},19,[577,815,735],{"class":626},[577,817,630],{"class":605},[577,819,740],{"class":587},[577,821,823],{"class":579,"line":822},20,[577,824,825],{"class":605},"    }\n",[577,827,829],{"class":579,"line":828},21,[577,830,831],{"class":605},"  ],\n",[577,833,835,838,841,844,846,849,851,854,856,859,861,864,866,869,871,874,876,879],{"class":579,"line":834},22,[577,836,837],{"class":626},"  \"pagination\"",[577,839,840],{"class":605},": { ",[577,842,843],{"class":626},"\"page\"",[577,845,630],{"class":605},[577,847,848],{"class":598},"1",[577,850,406],{"class":605},[577,852,853],{"class":626},"\"limit\"",[577,855,630],{"class":605},[577,857,858],{"class":598},"100",[577,860,406],{"class":605},[577,862,863],{"class":626},"\"total\"",[577,865,630],{"class":605},[577,867,868],{"class":598},"246",[577,870,406],{"class":605},[577,872,873],{"class":626},"\"totalPages\"",[577,875,630],{"class":605},[577,877,878],{"class":598},"3",[577,880,881],{"class":605}," }\n",[577,883,885],{"class":579,"line":884},23,[577,886,887],{"class":605},"}\n",[357,889,890,891,894,895,898,899,901,902,904],{},"The list is paginated like every listing: ",[392,892,893],{},"page"," defaults to 1, and ",[392,896,897],{},"limit"," defaults to 20 with a\nmaximum of 100. A larger ",[392,900,897],{}," is lowered to 100 rather than refused (see ",[397,903,39],{"href":40},").\nThe list has no guaranteed order, so page through all of it and index it yourself.",[361,906,907,920],{},[364,908,909],{},[367,910,911,914,917],{},[370,912,913],{},"Field",[370,915,916],{},"Type",[370,918,919],{},"Notes",[380,921,922,938,953,965,977,995],{},[367,923,924,929,932],{},[385,925,926],{},[392,927,928],{},"_id",[385,930,931],{},"string, 24 hex characters",[385,933,934,935,937],{},"The value ",[392,936,394],{}," takes at registration.",[367,939,940,945,948],{},[385,941,942],{},[392,943,944],{},"name",[385,946,947],{},"string",[385,949,950,951,479],{},"Stored in upper case, for example ",[392,952,688],{},[367,954,955,960,962],{},[385,956,957],{},[392,958,959],{},"iso2",[385,961,947],{},[385,963,964],{},"Two-letter code, upper case. It is also the first two characters of every username minted for a student in that country.",[367,966,967,972,974],{},[385,968,969],{},[392,970,971],{},"iso3",[385,973,947],{},[385,975,976],{},"Three-letter code, upper case.",[367,978,979,990,992],{},[385,980,981,406,984,406,987],{},[392,982,983],{},"tz",[392,985,986],{},"dialCode",[392,988,989],{},"flag",[385,991,947],{},[385,993,994],{},"Present on some countries.",[367,996,997,1005,1008],{},[385,998,999,406,1002],{},[392,1000,1001],{},"createdAt",[392,1003,1004],{},"updatedAt",[385,1006,1007],{},"ISO 8601 timestamp",[385,1009],{},[357,1011,1012,1013,1016],{},"A country document may carry other fields, such as ",[392,1014,1015],{},"__v",". Ignore fields you do not use.",[1018,1019,1021],"callout",{"type":1020},"note",[357,1022,1023,1027,1028,1030,1031,1034,1035],{},[1024,1025,1026],"strong",{},"Some countries cannot be selected."," They are left out of the list and out of the total, and\n",[392,1029,503],{}," answers for one of them exactly as it answers for an id that does not exist.\nA registration or update that names one is refused with ",[392,1032,1033],{},"400"," and ",[392,1036,1037],{},"country is not a known country.",[564,1039,1041],{"id":1040},"get-one-country","Get one country",[568,1043,1045],{"className":570,"code":1044,"language":572,"meta":573,"style":573},"curl \"https:\u002F\u002Fapi.main-team.org\u002Fv1\u002Fcountry\u002F630e0182c53dc79a6836e67e\" \\\n  -H \"Authorization: Bearer $TOKEN\"\n",[392,1046,1047,1056],{"__ignoreMap":573},[577,1048,1049,1051,1054],{"class":579,"line":580},[577,1050,584],{"class":583},[577,1052,1053],{"class":587}," \"https:\u002F\u002Fapi.main-team.org\u002Fv1\u002Fcountry\u002F630e0182c53dc79a6836e67e\"",[577,1055,592],{"class":591},[577,1057,1058,1060,1062,1064],{"class":579,"line":595},[577,1059,599],{"class":598},[577,1061,602],{"class":587},[577,1063,606],{"class":605},[577,1065,609],{"class":587},[568,1067,1069],{"className":612,"code":1068,"language":614,"meta":573,"style":573},"{\n  \"success\": true,\n  \"message\": \"Country fetched successfully.\",\n  \"data\": {\n    \"_id\": \"630e0182c53dc79a6836e67e\",\n    \"name\": \"GERMANY\",\n    \"iso2\": \"DE\",\n    \"iso3\": \"DEU\",\n    \"createdAt\": \"2022-08-30T12:14:26.118Z\",\n    \"updatedAt\": \"2022-08-30T12:14:26.118Z\"\n  }\n}\n",[392,1070,1071,1075,1085,1096,1103,1114,1125,1136,1147,1158,1167,1172],{"__ignoreMap":573},[577,1072,1073],{"class":579,"line":580},[577,1074,621],{"class":605},[577,1076,1077,1079,1081,1083],{"class":579,"line":595},[577,1078,627],{"class":626},[577,1080,630],{"class":605},[577,1082,633],{"class":598},[577,1084,636],{"class":605},[577,1086,1087,1089,1091,1094],{"class":579,"line":639},[577,1088,642],{"class":626},[577,1090,630],{"class":605},[577,1092,1093],{"class":587},"\"Country fetched successfully.\"",[577,1095,636],{"class":605},[577,1097,1098,1100],{"class":579,"line":652},[577,1099,655],{"class":626},[577,1101,1102],{"class":605},": {\n",[577,1104,1105,1108,1110,1112],{"class":579,"line":661},[577,1106,1107],{"class":626},"    \"_id\"",[577,1109,630],{"class":605},[577,1111,675],{"class":587},[577,1113,636],{"class":605},[577,1115,1116,1119,1121,1123],{"class":579,"line":667},[577,1117,1118],{"class":626},"    \"name\"",[577,1120,630],{"class":605},[577,1122,688],{"class":587},[577,1124,636],{"class":605},[577,1126,1127,1130,1132,1134],{"class":579,"line":680},[577,1128,1129],{"class":626},"    \"iso2\"",[577,1131,630],{"class":605},[577,1133,701],{"class":587},[577,1135,636],{"class":605},[577,1137,1138,1141,1143,1145],{"class":579,"line":693},[577,1139,1140],{"class":626},"    \"iso3\"",[577,1142,630],{"class":605},[577,1144,714],{"class":587},[577,1146,636],{"class":605},[577,1148,1149,1152,1154,1156],{"class":579,"line":706},[577,1150,1151],{"class":626},"    \"createdAt\"",[577,1153,630],{"class":605},[577,1155,727],{"class":587},[577,1157,636],{"class":605},[577,1159,1160,1163,1165],{"class":579,"line":719},[577,1161,1162],{"class":626},"    \"updatedAt\"",[577,1164,630],{"class":605},[577,1166,740],{"class":587},[577,1168,1169],{"class":579,"line":732},[577,1170,1171],{"class":605},"  }\n",[577,1173,1174],{"class":579,"line":743},[577,1175,887],{"class":605},[564,1177,1179,1180,1182],{"id":1178},"why-country-takes-an-id-and-nothing-else","Why ",[392,1181,394],{}," takes an id and nothing else",[357,1184,1185,1186,406,1188,1034,1191,1194,1195,1197,1198,1200,1201,1203,1204,1206],{},"At registration ",[392,1187,419],{},[392,1189,1190],{},"city",[392,1192,1193],{},"school"," accept a name, but ",[392,1196,394],{}," accepts only the ",[392,1199,928],{}," from\nthis list. A country has three common spellings (its name, its ISO2 code and its ISO3 code), and\nchoosing between them is ambiguity the field does not need. The country also scopes how a city or\nschool name is looked up, so it has to be exact. Build a lookup from ",[392,1202,959],{}," (or whatever code your\nown records use) to ",[392,1205,928],{}," once, and translate on your side.",[460,1208,414],{"id":1209},"grades",[564,1211,425],{"id":1212},"list-grades",[568,1214,1216],{"className":570,"code":1215,"language":572,"meta":573,"style":573},"curl \"https:\u002F\u002Fapi.main-team.org\u002Fv1\u002Fgrade?limit=100\" \\\n  -H \"Authorization: Bearer $TOKEN\"\n",[392,1217,1218,1227],{"__ignoreMap":573},[577,1219,1220,1222,1225],{"class":579,"line":580},[577,1221,584],{"class":583},[577,1223,1224],{"class":587}," \"https:\u002F\u002Fapi.main-team.org\u002Fv1\u002Fgrade?limit=100\"",[577,1226,592],{"class":591},[577,1228,1229,1231,1233,1235],{"class":579,"line":595},[577,1230,599],{"class":598},[577,1232,602],{"class":587},[577,1234,606],{"class":605},[577,1236,609],{"class":587},[568,1238,1240],{"className":612,"code":1239,"language":614,"meta":573,"style":573},"{\n  \"success\": true,\n  \"message\": \"Grades fetched successfully.\",\n  \"data\": [\n    {\n      \"_id\": \"630e01826836e67ec53dc79d\",\n      \"name\": \"1\",\n      \"createdAt\": \"2022-08-30T12:14:26.301Z\",\n      \"updatedAt\": \"2022-08-30T12:14:26.301Z\"\n    },\n    {\n      \"_id\": \"630e01826836e67ec53dc79e\",\n      \"name\": \"2\",\n      \"createdAt\": \"2022-08-30T12:14:26.302Z\",\n      \"updatedAt\": \"2022-08-30T12:14:26.302Z\"\n    }\n  ],\n  \"pagination\": { \"page\": 1, \"limit\": 100, \"total\": 12, \"totalPages\": 1 }\n}\n",[392,1241,1242,1246,1256,1267,1273,1277,1288,1299,1310,1319,1323,1327,1338,1349,1360,1369,1373,1377,1416],{"__ignoreMap":573},[577,1243,1244],{"class":579,"line":580},[577,1245,621],{"class":605},[577,1247,1248,1250,1252,1254],{"class":579,"line":595},[577,1249,627],{"class":626},[577,1251,630],{"class":605},[577,1253,633],{"class":598},[577,1255,636],{"class":605},[577,1257,1258,1260,1262,1265],{"class":579,"line":639},[577,1259,642],{"class":626},[577,1261,630],{"class":605},[577,1263,1264],{"class":587},"\"Grades fetched successfully.\"",[577,1266,636],{"class":605},[577,1268,1269,1271],{"class":579,"line":652},[577,1270,655],{"class":626},[577,1272,658],{"class":605},[577,1274,1275],{"class":579,"line":661},[577,1276,664],{"class":605},[577,1278,1279,1281,1283,1286],{"class":579,"line":667},[577,1280,670],{"class":626},[577,1282,630],{"class":605},[577,1284,1285],{"class":587},"\"630e01826836e67ec53dc79d\"",[577,1287,636],{"class":605},[577,1289,1290,1292,1294,1297],{"class":579,"line":680},[577,1291,683],{"class":626},[577,1293,630],{"class":605},[577,1295,1296],{"class":587},"\"1\"",[577,1298,636],{"class":605},[577,1300,1301,1303,1305,1308],{"class":579,"line":693},[577,1302,722],{"class":626},[577,1304,630],{"class":605},[577,1306,1307],{"class":587},"\"2022-08-30T12:14:26.301Z\"",[577,1309,636],{"class":605},[577,1311,1312,1314,1316],{"class":579,"line":706},[577,1313,735],{"class":626},[577,1315,630],{"class":605},[577,1317,1318],{"class":587},"\"2022-08-30T12:14:26.301Z\"\n",[577,1320,1321],{"class":579,"line":719},[577,1322,746],{"class":605},[577,1324,1325],{"class":579,"line":732},[577,1326,664],{"class":605},[577,1328,1329,1331,1333,1336],{"class":579,"line":743},[577,1330,670],{"class":626},[577,1332,630],{"class":605},[577,1334,1335],{"class":587},"\"630e01826836e67ec53dc79e\"",[577,1337,636],{"class":605},[577,1339,1340,1342,1344,1347],{"class":579,"line":749},[577,1341,683],{"class":626},[577,1343,630],{"class":605},[577,1345,1346],{"class":587},"\"2\"",[577,1348,636],{"class":605},[577,1350,1351,1353,1355,1358],{"class":579,"line":754},[577,1352,722],{"class":626},[577,1354,630],{"class":605},[577,1356,1357],{"class":587},"\"2022-08-30T12:14:26.302Z\"",[577,1359,636],{"class":605},[577,1361,1362,1364,1366],{"class":579,"line":766},[577,1363,735],{"class":626},[577,1365,630],{"class":605},[577,1367,1368],{"class":587},"\"2022-08-30T12:14:26.302Z\"\n",[577,1370,1371],{"class":579,"line":778},[577,1372,825],{"class":605},[577,1374,1375],{"class":579,"line":790},[577,1376,831],{"class":605},[577,1378,1379,1381,1383,1385,1387,1389,1391,1393,1395,1397,1399,1401,1403,1406,1408,1410,1412,1414],{"class":579,"line":802},[577,1380,837],{"class":626},[577,1382,840],{"class":605},[577,1384,843],{"class":626},[577,1386,630],{"class":605},[577,1388,848],{"class":598},[577,1390,406],{"class":605},[577,1392,853],{"class":626},[577,1394,630],{"class":605},[577,1396,858],{"class":598},[577,1398,406],{"class":605},[577,1400,863],{"class":626},[577,1402,630],{"class":605},[577,1404,1405],{"class":598},"12",[577,1407,406],{"class":605},[577,1409,873],{"class":626},[577,1411,630],{"class":605},[577,1413,848],{"class":598},[577,1415,881],{"class":605},[577,1417,1418],{"class":579,"line":813},[577,1419,887],{"class":605},[357,1421,1422,1423,1425,1426,1429,1430,479],{},"Grades come back in the order they were created, oldest first. They are not sorted by ",[392,1424,944],{},": names\nare strings, and sorting them as text would put ",[392,1427,1428],{},"\"10\""," before ",[392,1431,1346],{},[361,1433,1434,1444],{},[364,1435,1436],{},[367,1437,1438,1440,1442],{},[370,1439,913],{},[370,1441,916],{},[370,1443,919],{},[380,1445,1446,1457,1470],{},[367,1447,1448,1452,1454],{},[385,1449,1450],{},[392,1451,928],{},[385,1453,931],{},[385,1455,1456],{},"The same id on every organization.",[367,1458,1459,1463,1465],{},[385,1460,1461],{},[392,1462,944],{},[385,1464,947],{},[385,1466,1467,1468,479],{},"The grade as a school would say it, for example ",[392,1469,1428],{},[367,1471,1472,1478,1480],{},[385,1473,1474,406,1476],{},[392,1475,1001],{},[392,1477,1004],{},[385,1479,1007],{},[385,1481],{},[564,1483,1485],{"id":1484},"grade-ids-are-the-same-everywhere","Grade ids are the same everywhere",[357,1487,1488,1489,1491,1492,1494],{},"A grade has the same ",[392,1490,928],{}," on the core record and on every organization. That is why a student's grade\ncan be checked directly against the grades an exam accepts, on any organization, without translation.\nIt is also why the API is strict about the ",[392,1493,419],{}," field: a grade that does not exist in this list is a\nstudent no exam will ever accept.",[564,1496,1498],{"id":1497},"a-name-works-too","A name works too",[357,1500,1501,1502,1504,1505,1507,1508,1510,1511,1514,1515,1518,1519,1521,1522,1524,1525,1528],{},"When you register or update a student, ",[392,1503,419],{}," takes either an ",[392,1506,928],{}," from this list or its ",[392,1509,944],{},".\n",[392,1512,1513],{},"\"grade\": \"10\""," is resolved to the grade whose name is ",[392,1516,1517],{},"10",", and that grade's ",[392,1520,928],{}," is what gets stored,\nso the two forms end in the same place. A name that matches no grade is refused with ",[392,1523,1033],{}," and\n",[392,1526,1527],{},"grade is not a known grade. This API does not create reference data."," This list shows which names are\naccepted.",[564,1530,1532],{"id":1531},"get-one-grade","Get one grade",[568,1534,1536],{"className":570,"code":1535,"language":572,"meta":573,"style":573},"curl \"https:\u002F\u002Fapi.main-team.org\u002Fv1\u002Fgrade\u002F630e01826836e67ec53dc79d\" \\\n  -H \"Authorization: Bearer $TOKEN\"\n",[392,1537,1538,1547],{"__ignoreMap":573},[577,1539,1540,1542,1545],{"class":579,"line":580},[577,1541,584],{"class":583},[577,1543,1544],{"class":587}," \"https:\u002F\u002Fapi.main-team.org\u002Fv1\u002Fgrade\u002F630e01826836e67ec53dc79d\"",[577,1546,592],{"class":591},[577,1548,1549,1551,1553,1555],{"class":579,"line":595},[577,1550,599],{"class":598},[577,1552,602],{"class":587},[577,1554,606],{"class":605},[577,1556,609],{"class":587},[568,1558,1560],{"className":612,"code":1559,"language":614,"meta":573,"style":573},"{\n  \"success\": true,\n  \"message\": \"Grade fetched successfully.\",\n  \"data\": {\n    \"_id\": \"630e01826836e67ec53dc79d\",\n    \"name\": \"1\",\n    \"createdAt\": \"2022-08-30T12:14:26.301Z\",\n    \"updatedAt\": \"2022-08-30T12:14:26.301Z\"\n  }\n}\n",[392,1561,1562,1566,1576,1587,1593,1603,1613,1623,1631,1635],{"__ignoreMap":573},[577,1563,1564],{"class":579,"line":580},[577,1565,621],{"class":605},[577,1567,1568,1570,1572,1574],{"class":579,"line":595},[577,1569,627],{"class":626},[577,1571,630],{"class":605},[577,1573,633],{"class":598},[577,1575,636],{"class":605},[577,1577,1578,1580,1582,1585],{"class":579,"line":639},[577,1579,642],{"class":626},[577,1581,630],{"class":605},[577,1583,1584],{"class":587},"\"Grade fetched successfully.\"",[577,1586,636],{"class":605},[577,1588,1589,1591],{"class":579,"line":652},[577,1590,655],{"class":626},[577,1592,1102],{"class":605},[577,1594,1595,1597,1599,1601],{"class":579,"line":661},[577,1596,1107],{"class":626},[577,1598,630],{"class":605},[577,1600,1285],{"class":587},[577,1602,636],{"class":605},[577,1604,1605,1607,1609,1611],{"class":579,"line":667},[577,1606,1118],{"class":626},[577,1608,630],{"class":605},[577,1610,1296],{"class":587},[577,1612,636],{"class":605},[577,1614,1615,1617,1619,1621],{"class":579,"line":680},[577,1616,1151],{"class":626},[577,1618,630],{"class":605},[577,1620,1307],{"class":587},[577,1622,636],{"class":605},[577,1624,1625,1627,1629],{"class":579,"line":693},[577,1626,1162],{"class":626},[577,1628,630],{"class":605},[577,1630,1318],{"class":587},[577,1632,1633],{"class":579,"line":706},[577,1634,1171],{"class":605},[577,1636,1637],{"class":579,"line":719},[577,1638,887],{"class":605},[460,1640,22],{"id":1641},"organizations",[564,1643,447],{"id":1644},"list-organizations",[568,1646,1648],{"className":570,"code":1647,"language":572,"meta":573,"style":573},"curl \"https:\u002F\u002Fapi.main-team.org\u002Fv1\u002Forganization\" \\\n  -H \"Authorization: Bearer $TOKEN\"\n",[392,1649,1650,1659],{"__ignoreMap":573},[577,1651,1652,1654,1657],{"class":579,"line":580},[577,1653,584],{"class":583},[577,1655,1656],{"class":587}," \"https:\u002F\u002Fapi.main-team.org\u002Fv1\u002Forganization\"",[577,1658,592],{"class":591},[577,1660,1661,1663,1665,1667],{"class":579,"line":595},[577,1662,599],{"class":598},[577,1664,602],{"class":587},[577,1666,606],{"class":605},[577,1668,609],{"class":587},[568,1670,1672],{"className":612,"code":1671,"language":614,"meta":573,"style":573},"{\n  \"success\": true,\n  \"message\": \"Organizations fetched successfully.\",\n  \"data\": [\n    {\n      \"_id\": \"64b7f0c2a1e4d93b5c2f1a02\",\n      \"name\": \"STEM Olympiad\",\n      \"slug\": \"stem\",\n      \"logo\": \"https:\u002F\u002Fcdn.example.org\u002Flogos\u002Fstem.svg\",\n      \"desc\": \"International STEM olympiad.\",\n      \"defaultRedirect\": \"https:\u002F\u002Fmy.stemolympiad.org\"\n    },\n    {\n      \"_id\": \"64b7f0c2a1e4d93b5c2f1a03\",\n      \"name\": \"Hi-Lingua\",\n      \"slug\": \"hilingua\",\n      \"logo\": \"https:\u002F\u002Fcdn.example.org\u002Flogos\u002Fhilingua.svg\",\n      \"desc\": \"International language olympiad.\"\n    }\n  ],\n  \"pagination\": { \"page\": 1, \"limit\": 20, \"total\": 5, \"totalPages\": 1 }\n}\n",[392,1673,1674,1678,1688,1699,1705,1709,1720,1731,1743,1755,1767,1777,1781,1785,1796,1807,1818,1829,1838,1842,1846,1886],{"__ignoreMap":573},[577,1675,1676],{"class":579,"line":580},[577,1677,621],{"class":605},[577,1679,1680,1682,1684,1686],{"class":579,"line":595},[577,1681,627],{"class":626},[577,1683,630],{"class":605},[577,1685,633],{"class":598},[577,1687,636],{"class":605},[577,1689,1690,1692,1694,1697],{"class":579,"line":639},[577,1691,642],{"class":626},[577,1693,630],{"class":605},[577,1695,1696],{"class":587},"\"Organizations fetched successfully.\"",[577,1698,636],{"class":605},[577,1700,1701,1703],{"class":579,"line":652},[577,1702,655],{"class":626},[577,1704,658],{"class":605},[577,1706,1707],{"class":579,"line":661},[577,1708,664],{"class":605},[577,1710,1711,1713,1715,1718],{"class":579,"line":667},[577,1712,670],{"class":626},[577,1714,630],{"class":605},[577,1716,1717],{"class":587},"\"64b7f0c2a1e4d93b5c2f1a02\"",[577,1719,636],{"class":605},[577,1721,1722,1724,1726,1729],{"class":579,"line":680},[577,1723,683],{"class":626},[577,1725,630],{"class":605},[577,1727,1728],{"class":587},"\"STEM Olympiad\"",[577,1730,636],{"class":605},[577,1732,1733,1736,1738,1741],{"class":579,"line":693},[577,1734,1735],{"class":626},"      \"slug\"",[577,1737,630],{"class":605},[577,1739,1740],{"class":587},"\"stem\"",[577,1742,636],{"class":605},[577,1744,1745,1748,1750,1753],{"class":579,"line":706},[577,1746,1747],{"class":626},"      \"logo\"",[577,1749,630],{"class":605},[577,1751,1752],{"class":587},"\"https:\u002F\u002Fcdn.example.org\u002Flogos\u002Fstem.svg\"",[577,1754,636],{"class":605},[577,1756,1757,1760,1762,1765],{"class":579,"line":719},[577,1758,1759],{"class":626},"      \"desc\"",[577,1761,630],{"class":605},[577,1763,1764],{"class":587},"\"International STEM olympiad.\"",[577,1766,636],{"class":605},[577,1768,1769,1772,1774],{"class":579,"line":732},[577,1770,1771],{"class":626},"      \"defaultRedirect\"",[577,1773,630],{"class":605},[577,1775,1776],{"class":587},"\"https:\u002F\u002Fmy.stemolympiad.org\"\n",[577,1778,1779],{"class":579,"line":743},[577,1780,746],{"class":605},[577,1782,1783],{"class":579,"line":749},[577,1784,664],{"class":605},[577,1786,1787,1789,1791,1794],{"class":579,"line":754},[577,1788,670],{"class":626},[577,1790,630],{"class":605},[577,1792,1793],{"class":587},"\"64b7f0c2a1e4d93b5c2f1a03\"",[577,1795,636],{"class":605},[577,1797,1798,1800,1802,1805],{"class":579,"line":766},[577,1799,683],{"class":626},[577,1801,630],{"class":605},[577,1803,1804],{"class":587},"\"Hi-Lingua\"",[577,1806,636],{"class":605},[577,1808,1809,1811,1813,1816],{"class":579,"line":778},[577,1810,1735],{"class":626},[577,1812,630],{"class":605},[577,1814,1815],{"class":587},"\"hilingua\"",[577,1817,636],{"class":605},[577,1819,1820,1822,1824,1827],{"class":579,"line":790},[577,1821,1747],{"class":626},[577,1823,630],{"class":605},[577,1825,1826],{"class":587},"\"https:\u002F\u002Fcdn.example.org\u002Flogos\u002Fhilingua.svg\"",[577,1828,636],{"class":605},[577,1830,1831,1833,1835],{"class":579,"line":802},[577,1832,1759],{"class":626},[577,1834,630],{"class":605},[577,1836,1837],{"class":587},"\"International language olympiad.\"\n",[577,1839,1840],{"class":579,"line":813},[577,1841,825],{"class":605},[577,1843,1844],{"class":579,"line":822},[577,1845,831],{"class":605},[577,1847,1848,1850,1852,1854,1856,1858,1860,1862,1864,1867,1869,1871,1873,1876,1878,1880,1882,1884],{"class":579,"line":828},[577,1849,837],{"class":626},[577,1851,840],{"class":605},[577,1853,843],{"class":626},[577,1855,630],{"class":605},[577,1857,848],{"class":598},[577,1859,406],{"class":605},[577,1861,853],{"class":626},[577,1863,630],{"class":605},[577,1865,1866],{"class":598},"20",[577,1868,406],{"class":605},[577,1870,863],{"class":626},[577,1872,630],{"class":605},[577,1874,1875],{"class":598},"5",[577,1877,406],{"class":605},[577,1879,873],{"class":626},[577,1881,630],{"class":605},[577,1883,848],{"class":598},[577,1885,881],{"class":605},[577,1887,1888],{"class":579,"line":834},[577,1889,887],{"class":605},[357,1891,1892,1893,1895,1896,1898,1899,1903,1904,1907],{},"The list holds the five organizations that run exams: stem, hilingua, neo, gmath and coding. ",[392,1894,471],{},",\nthe core record, is not listed. The routes without an ",[392,1897,437],{}," act on it, so you never\nneed its id, and ",[397,1900,1901],{"href":165},[392,1902,533],{}," answers ",[392,1905,1906],{},"404"," for it.",[357,1909,1910],{},"An organization comes back with exactly these fields:",[361,1912,1913,1923],{},[364,1914,1915],{},[367,1916,1917,1919,1921],{},[370,1918,913],{},[370,1920,916],{},[370,1922,919],{},[380,1924,1925,1941,1952,1986,1998,2010],{},[367,1926,1927,1931,1933],{},[385,1928,1929],{},[392,1930,928],{},[385,1932,931],{},[385,1934,390,1935,1937,1938,1940],{},[392,1936,437],{}," every ",[392,1939,441],{}," route takes.",[367,1942,1943,1947,1949],{},[385,1944,1945],{},[392,1946,944],{},[385,1948,947],{},[385,1950,1951],{},"Display name.",[367,1953,1954,1959,1961],{},[385,1955,1956],{},[392,1957,1958],{},"slug",[385,1960,947],{},[385,1962,1963,1964,406,1967,406,1970,406,1973,475,1976,1979,1980,406,1983,479],{},"Short name: ",[392,1965,1966],{},"stem",[392,1968,1969],{},"hilingua",[392,1971,1972],{},"neo",[392,1974,1975],{},"gmath",[392,1977,1978],{},"coding",". Used in role targets and in a student's ",[392,1981,1982],{},"activatedPlatformsThisSeason",[1024,1984,1985],{},"never in a path",[367,1987,1988,1993,1995],{},[385,1989,1990],{},[392,1991,1992],{},"logo",[385,1994,947],{},[385,1996,1997],{},"Logo URL, when set.",[367,1999,2000,2005,2007],{},[385,2001,2002],{},[392,2003,2004],{},"desc",[385,2006,947],{},[385,2008,2009],{},"Description, when set.",[367,2011,2012,2017,2019],{},[385,2013,2014],{},[392,2015,2016],{},"defaultRedirect",[385,2018,947],{},[385,2020,2021,2022,2025,2026,2029],{},"Where a ",[397,2023,2024],{"href":81},"sign-in link"," sends the student when you give no ",[392,2027,2028],{},"redirect",", when set.",[564,2031,2033,2034,2036],{"id":2032},"use-the-_id-never-the-slug","Use the ",[392,2035,928],{},", never the slug",[357,2038,2039,2042,2043,2045,2046,2049,2050,2052,2053,552,2059,2062,2063,2066],{},[392,2040,2041],{},"\u002Fv1\u002Fstem\u002Fexam"," does not work. The path segment must be the organization's ",[392,2044,928],{},":\n",[392,2047,2048],{},"\u002Fv1\u002F64b7f0c2a1e4d93b5c2f1a02\u002Fexam",". A segment that is not 24 hex characters, or that names no\norganization, is answered with ",[392,2051,1906],{},", code ",[397,2054,2056],{"href":2055},"\u002Fapi\u002Ferrors#not_found",[392,2057,2058],{},"not_found",[392,2060,2061],{},"Organization not found!",". That check runs after your token is checked, so a request without a valid\ntoken gets ",[392,2064,2065],{},"401"," whatever the path says.",[568,2068,2070],{"className":612,"code":2069,"language":614,"meta":573,"style":573},"{\n  \"error\": {\n    \"code\": \"not_found\",\n    \"message\": \"Organization not found!\",\n    \"documentation_url\": \"https:\u002F\u002Fhub.main-team.org\u002Fapi\u002Ferrors#not_found\",\n    \"request_id\": \"3f9d2c1e-7a4b-4e0f-9c3d-1b2a5e6f7d80\"\n  }\n}\n",[392,2071,2072,2076,2083,2095,2107,2119,2129,2133],{"__ignoreMap":573},[577,2073,2074],{"class":579,"line":580},[577,2075,621],{"class":605},[577,2077,2078,2081],{"class":579,"line":595},[577,2079,2080],{"class":626},"  \"error\"",[577,2082,1102],{"class":605},[577,2084,2085,2088,2090,2093],{"class":579,"line":639},[577,2086,2087],{"class":626},"    \"code\"",[577,2089,630],{"class":605},[577,2091,2092],{"class":587},"\"not_found\"",[577,2094,636],{"class":605},[577,2096,2097,2100,2102,2105],{"class":579,"line":652},[577,2098,2099],{"class":626},"    \"message\"",[577,2101,630],{"class":605},[577,2103,2104],{"class":587},"\"Organization not found!\"",[577,2106,636],{"class":605},[577,2108,2109,2112,2114,2117],{"class":579,"line":661},[577,2110,2111],{"class":626},"    \"documentation_url\"",[577,2113,630],{"class":605},[577,2115,2116],{"class":587},"\"https:\u002F\u002Fhub.main-team.org\u002Fapi\u002Ferrors#not_found\"",[577,2118,636],{"class":605},[577,2120,2121,2124,2126],{"class":579,"line":667},[577,2122,2123],{"class":626},"    \"request_id\"",[577,2125,630],{"class":605},[577,2127,2128],{"class":587},"\"3f9d2c1e-7a4b-4e0f-9c3d-1b2a5e6f7d80\"\n",[577,2130,2131],{"class":579,"line":680},[577,2132,1171],{"class":605},[577,2134,2135],{"class":579,"line":693},[577,2136,887],{"class":605},[357,2138,2139,2140,2142,2143,2145,2146,2148,2149,479],{},"Organization ids do not change, so fetch the list once, keep a map from ",[392,2141,1958],{}," to ",[392,2144,928],{},", and use the\nmap everywhere you build a path. ",[397,2147,22],{"href":23}," explains what the core record\nand the five olympiads are, and why the flat routes act on ",[392,2150,471],{},[564,2152,2154],{"id":2153},"get-one-organization","Get one organization",[568,2156,2158],{"className":570,"code":2157,"language":572,"meta":573,"style":573},"curl \"https:\u002F\u002Fapi.main-team.org\u002Fv1\u002Forganization\u002F64b7f0c2a1e4d93b5c2f1a02\" \\\n  -H \"Authorization: Bearer $TOKEN\"\n",[392,2159,2160,2169],{"__ignoreMap":573},[577,2161,2162,2164,2167],{"class":579,"line":580},[577,2163,584],{"class":583},[577,2165,2166],{"class":587}," \"https:\u002F\u002Fapi.main-team.org\u002Fv1\u002Forganization\u002F64b7f0c2a1e4d93b5c2f1a02\"",[577,2168,592],{"class":591},[577,2170,2171,2173,2175,2177],{"class":579,"line":595},[577,2172,599],{"class":598},[577,2174,602],{"class":587},[577,2176,606],{"class":605},[577,2178,609],{"class":587},[568,2180,2182],{"className":612,"code":2181,"language":614,"meta":573,"style":573},"{\n  \"success\": true,\n  \"message\": \"Organization fetched successfully.\",\n  \"data\": {\n    \"_id\": \"64b7f0c2a1e4d93b5c2f1a02\",\n    \"name\": \"STEM Olympiad\",\n    \"slug\": \"stem\",\n    \"logo\": \"https:\u002F\u002Fcdn.example.org\u002Flogos\u002Fstem.svg\",\n    \"desc\": \"International STEM olympiad.\",\n    \"defaultRedirect\": \"https:\u002F\u002Fmy.stemolympiad.org\"\n  }\n}\n",[392,2183,2184,2188,2198,2209,2215,2225,2235,2246,2257,2268,2277,2281],{"__ignoreMap":573},[577,2185,2186],{"class":579,"line":580},[577,2187,621],{"class":605},[577,2189,2190,2192,2194,2196],{"class":579,"line":595},[577,2191,627],{"class":626},[577,2193,630],{"class":605},[577,2195,633],{"class":598},[577,2197,636],{"class":605},[577,2199,2200,2202,2204,2207],{"class":579,"line":639},[577,2201,642],{"class":626},[577,2203,630],{"class":605},[577,2205,2206],{"class":587},"\"Organization fetched successfully.\"",[577,2208,636],{"class":605},[577,2210,2211,2213],{"class":579,"line":652},[577,2212,655],{"class":626},[577,2214,1102],{"class":605},[577,2216,2217,2219,2221,2223],{"class":579,"line":661},[577,2218,1107],{"class":626},[577,2220,630],{"class":605},[577,2222,1717],{"class":587},[577,2224,636],{"class":605},[577,2226,2227,2229,2231,2233],{"class":579,"line":667},[577,2228,1118],{"class":626},[577,2230,630],{"class":605},[577,2232,1728],{"class":587},[577,2234,636],{"class":605},[577,2236,2237,2240,2242,2244],{"class":579,"line":680},[577,2238,2239],{"class":626},"    \"slug\"",[577,2241,630],{"class":605},[577,2243,1740],{"class":587},[577,2245,636],{"class":605},[577,2247,2248,2251,2253,2255],{"class":579,"line":693},[577,2249,2250],{"class":626},"    \"logo\"",[577,2252,630],{"class":605},[577,2254,1752],{"class":587},[577,2256,636],{"class":605},[577,2258,2259,2262,2264,2266],{"class":579,"line":706},[577,2260,2261],{"class":626},"    \"desc\"",[577,2263,630],{"class":605},[577,2265,1764],{"class":587},[577,2267,636],{"class":605},[577,2269,2270,2273,2275],{"class":579,"line":719},[577,2271,2272],{"class":626},"    \"defaultRedirect\"",[577,2274,630],{"class":605},[577,2276,1776],{"class":587},[577,2278,2279],{"class":579,"line":732},[577,2280,1171],{"class":605},[577,2282,2283],{"class":579,"line":743},[577,2284,887],{"class":605},[460,2286,2288],{"id":2287},"ids-that-are-unknown-or-malformed","Ids that are unknown or malformed",[361,2290,2291,2310],{},[364,2292,2293],{},[367,2294,2295,2298,2302,2306],{},[370,2296,2297],{},"You send",[370,2299,2300],{},[392,2301,503],{},[370,2303,2304],{},[392,2305,518],{},[370,2307,2308],{},[392,2309,533],{},[380,2311,2312,2337],{},[367,2313,2314,2317,2324,2331],{},[385,2315,2316],{},"A well-formed id that matches nothing",[385,2318,2319,406,2321],{},[392,2320,1906],{},[392,2322,2323],{},"Country not found!",[385,2325,2326,406,2328],{},[392,2327,1906],{},[392,2329,2330],{},"Grade not found!",[385,2332,2333,406,2335],{},[392,2334,1906],{},[392,2336,2061],{},[367,2338,2339,2342,2349,2352],{},[385,2340,2341],{},"Anything that is not 24 hex characters",[385,2343,2344,406,2346],{},[392,2345,1033],{},[392,2347,2348],{},"Invalid value for '_id': expected ObjectId.",[385,2350,2351],{},"the same",[385,2353,2351],{},[357,2355,2356,2357,2359,2360,2362,2363,2367,2368,2370,2371,479],{},"A country that cannot be selected answers like an unknown id, and so does an organization the list\nleaves out, ",[392,2358,471],{}," included. Every ",[392,2361,1906],{}," here has the code ",[397,2364,2365],{"href":2055},[392,2366,2058],{},", and\nevery ",[392,2369,1033],{}," the code ",[397,2372,2374],{"href":2373},"\u002Fapi\u002Ferrors#bad_request",[392,2375,2376],{},"bad_request",[460,2378,2380],{"id":2379},"cities-and-schools","Cities and schools",[357,2382,2383,2384,2386,2387,2389,2390,2394,2395,2397],{},"There is no route that lists cities or schools. At registration you name them instead: ",[392,2385,1190],{}," is\nlooked up by name within the student's country, and ",[392,2388,1193],{}," within that country and city. A name the\nplatform does not know is refused, and the API cannot add one. If a real city or school is refused,\nwrite to ",[397,2391,2393],{"href":2392},"mailto:info@main-team.org","info@main-team.org"," with the country, city and school as your\nrecords have them. ",[397,2396,62],{"href":456}," describes the lookup\nrules in full.",[460,2399,2401],{"id":2400},"caching","Caching",[357,2403,2404,2405,2408],{},"Reference data changes rarely, and each read counts against your ",[397,2406,2407],{"href":46},"rate limit","\n(100 requests per 60 seconds per operation). A sensible pattern:",[2410,2411,2412,2416,2419],"ul",{},[2413,2414,2415],"li",{},"Load all organizations, countries and grades when your integration starts, and keep them in memory\nor in your own store.",[2413,2417,2418],{},"Refresh them once a day.",[2413,2420,2421,2422,2424,2425,2428],{},"Refresh early when a student write is refused with ",[392,2423,1037],{}," or\n",[392,2426,2427],{},"grade is not a known grade."," for an id you took from your cache. Then retry once with the fresh\ndata.",[357,2430,2431,2432,2435],{},"This loader builds the three maps you need. It follows ",[392,2433,2434],{},"totalPages",", so it works however large a\nlist grows.",[568,2437,2441],{"className":2438,"code":2439,"filename":308,"language":2440,"meta":573,"style":573},"language-js shiki shiki-themes github-light-high-contrast github-dark-high-contrast","const BASE = 'https:\u002F\u002Fapi.main-team.org\u002Fv1';\n\nasync function getAll(path, token) {\n  const items = [];\n  for (let page = 1; ; page++) {\n    const res = await fetch(`${BASE}${path}?page=${page}&limit=100`, {\n      headers: { Authorization: `Bearer ${token}` },\n    });\n    if (!res.ok) throw new Error(`${path}: HTTP ${res.status}`);\n    const body = await res.json();\n    items.push(...body.data);\n    if (page >= body.pagination.totalPages) return items;\n  }\n}\n\nexport async function loadReferenceData(token) {\n  const [organizations, countries, grades] = await Promise.all([\n    getAll('\u002Forganization', token),\n    getAll('\u002Fcountry', token),\n    getAll('\u002Fgrade', token),\n  ]);\n  return {\n    organizationIdBySlug: new Map(organizations.map((o) => [o.slug, o._id])),\n    countryIdByIso2: new Map(countries.map((c) => [c.iso2, c._id])),\n    gradeIdByName: new Map(grades.map((g) => [g.name, g._id])),\n  };\n}\n\n\u002F\u002F const ref = await loadReferenceData(token);\n\u002F\u002F ref.organizationIdBySlug.get('stem')  \u002F\u002F \"64b7f0c2a1e4d93b5c2f1a02\"\n\u002F\u002F ref.countryIdByIso2.get('AL')         \u002F\u002F \"630e0182c53dc79a6836e67e\"\n","js",[392,2442,2443,2460,2466,2492,2505,2533,2573,2589,2594,2638,2657,2673,2692,2696,2700,2704,2723,2758,2771,2782,2793,2798,2806,2838,2865,2892,2898,2903,2908,2915,2924],{"__ignoreMap":573},[577,2444,2445,2448,2451,2454,2457],{"class":579,"line":580},[577,2446,2447],{"class":591},"const",[577,2449,2450],{"class":598}," BASE",[577,2452,2453],{"class":591}," =",[577,2455,2456],{"class":587}," 'https:\u002F\u002Fapi.main-team.org\u002Fv1'",[577,2458,2459],{"class":605},";\n",[577,2461,2462],{"class":579,"line":595},[577,2463,2465],{"emptyLinePlaceholder":2464},true,"\n",[577,2467,2468,2471,2474,2478,2481,2484,2486,2489],{"class":579,"line":639},[577,2469,2470],{"class":591},"async",[577,2472,2473],{"class":591}," function",[577,2475,2477],{"class":2476},"sKwhi"," getAll",[577,2479,2480],{"class":605},"(",[577,2482,2483],{"class":583},"path",[577,2485,406],{"class":605},[577,2487,2488],{"class":583},"token",[577,2490,2491],{"class":605},") {\n",[577,2493,2494,2497,2500,2502],{"class":579,"line":652},[577,2495,2496],{"class":591},"  const",[577,2498,2499],{"class":598}," items",[577,2501,2453],{"class":591},[577,2503,2504],{"class":605}," [];\n",[577,2506,2507,2510,2513,2516,2519,2522,2525,2528,2531],{"class":579,"line":661},[577,2508,2509],{"class":591},"  for",[577,2511,2512],{"class":605}," (",[577,2514,2515],{"class":591},"let",[577,2517,2518],{"class":605}," page ",[577,2520,2521],{"class":591},"=",[577,2523,2524],{"class":598}," 1",[577,2526,2527],{"class":605},"; ; page",[577,2529,2530],{"class":591},"++",[577,2532,2491],{"class":605},[577,2534,2535,2538,2541,2543,2546,2549,2551,2554,2557,2560,2562,2565,2567,2570],{"class":579,"line":667},[577,2536,2537],{"class":591},"    const",[577,2539,2540],{"class":598}," res",[577,2542,2453],{"class":591},[577,2544,2545],{"class":591}," await",[577,2547,2548],{"class":2476}," fetch",[577,2550,2480],{"class":605},[577,2552,2553],{"class":587},"`${",[577,2555,2556],{"class":598},"BASE",[577,2558,2559],{"class":587},"}${",[577,2561,2483],{"class":605},[577,2563,2564],{"class":587},"}?page=${",[577,2566,893],{"class":605},[577,2568,2569],{"class":587},"}&limit=100`",[577,2571,2572],{"class":605},", {\n",[577,2574,2575,2578,2581,2583,2586],{"class":579,"line":680},[577,2576,2577],{"class":605},"      headers: { Authorization: ",[577,2579,2580],{"class":587},"`Bearer ${",[577,2582,2488],{"class":605},[577,2584,2585],{"class":587},"}`",[577,2587,2588],{"class":605}," },\n",[577,2590,2591],{"class":579,"line":693},[577,2592,2593],{"class":605},"    });\n",[577,2595,2596,2599,2601,2604,2607,2610,2613,2616,2618,2620,2622,2625,2628,2630,2633,2635],{"class":579,"line":706},[577,2597,2598],{"class":591},"    if",[577,2600,2512],{"class":605},[577,2602,2603],{"class":591},"!",[577,2605,2606],{"class":605},"res.ok) ",[577,2608,2609],{"class":591},"throw",[577,2611,2612],{"class":591}," new",[577,2614,2615],{"class":2476}," Error",[577,2617,2480],{"class":605},[577,2619,2553],{"class":587},[577,2621,2483],{"class":605},[577,2623,2624],{"class":587},"}: HTTP ${",[577,2626,2627],{"class":605},"res",[577,2629,479],{"class":587},[577,2631,2632],{"class":605},"status",[577,2634,2585],{"class":587},[577,2636,2637],{"class":605},");\n",[577,2639,2640,2642,2645,2647,2649,2652,2654],{"class":579,"line":719},[577,2641,2537],{"class":591},[577,2643,2644],{"class":598}," body",[577,2646,2453],{"class":591},[577,2648,2545],{"class":591},[577,2650,2651],{"class":605}," res.",[577,2653,614],{"class":2476},[577,2655,2656],{"class":605},"();\n",[577,2658,2659,2662,2665,2667,2670],{"class":579,"line":732},[577,2660,2661],{"class":605},"    items.",[577,2663,2664],{"class":2476},"push",[577,2666,2480],{"class":605},[577,2668,2669],{"class":591},"...",[577,2671,2672],{"class":605},"body.data);\n",[577,2674,2675,2677,2680,2683,2686,2689],{"class":579,"line":743},[577,2676,2598],{"class":591},[577,2678,2679],{"class":605}," (page ",[577,2681,2682],{"class":591},">=",[577,2684,2685],{"class":605}," body.pagination.totalPages) ",[577,2687,2688],{"class":591},"return",[577,2690,2691],{"class":605}," items;\n",[577,2693,2694],{"class":579,"line":749},[577,2695,1171],{"class":605},[577,2697,2698],{"class":579,"line":754},[577,2699,887],{"class":605},[577,2701,2702],{"class":579,"line":766},[577,2703,2465],{"emptyLinePlaceholder":2464},[577,2705,2706,2709,2712,2714,2717,2719,2721],{"class":579,"line":778},[577,2707,2708],{"class":591},"export",[577,2710,2711],{"class":591}," async",[577,2713,2473],{"class":591},[577,2715,2716],{"class":2476}," loadReferenceData",[577,2718,2480],{"class":605},[577,2720,2488],{"class":583},[577,2722,2491],{"class":605},[577,2724,2725,2727,2730,2732,2734,2736,2738,2740,2743,2745,2747,2750,2752,2755],{"class":579,"line":790},[577,2726,2496],{"class":591},[577,2728,2729],{"class":605}," [",[577,2731,1641],{"class":598},[577,2733,406],{"class":605},[577,2735,562],{"class":598},[577,2737,406],{"class":605},[577,2739,1209],{"class":598},[577,2741,2742],{"class":605},"] ",[577,2744,2521],{"class":591},[577,2746,2545],{"class":591},[577,2748,2749],{"class":598}," Promise",[577,2751,479],{"class":605},[577,2753,2754],{"class":2476},"all",[577,2756,2757],{"class":605},"([\n",[577,2759,2760,2763,2765,2768],{"class":579,"line":802},[577,2761,2762],{"class":2476},"    getAll",[577,2764,2480],{"class":605},[577,2766,2767],{"class":587},"'\u002Forganization'",[577,2769,2770],{"class":605},", token),\n",[577,2772,2773,2775,2777,2780],{"class":579,"line":813},[577,2774,2762],{"class":2476},[577,2776,2480],{"class":605},[577,2778,2779],{"class":587},"'\u002Fcountry'",[577,2781,2770],{"class":605},[577,2783,2784,2786,2788,2791],{"class":579,"line":822},[577,2785,2762],{"class":2476},[577,2787,2480],{"class":605},[577,2789,2790],{"class":587},"'\u002Fgrade'",[577,2792,2770],{"class":605},[577,2794,2795],{"class":579,"line":828},[577,2796,2797],{"class":605},"  ]);\n",[577,2799,2800,2803],{"class":579,"line":834},[577,2801,2802],{"class":591},"  return",[577,2804,2805],{"class":605}," {\n",[577,2807,2808,2811,2814,2817,2820,2823,2826,2829,2832,2835],{"class":579,"line":884},[577,2809,2810],{"class":605},"    organizationIdBySlug: ",[577,2812,2813],{"class":591},"new",[577,2815,2816],{"class":2476}," Map",[577,2818,2819],{"class":605},"(organizations.",[577,2821,2822],{"class":2476},"map",[577,2824,2825],{"class":605},"((",[577,2827,2828],{"class":583},"o",[577,2830,2831],{"class":605},") ",[577,2833,2834],{"class":591},"=>",[577,2836,2837],{"class":605}," [o.slug, o._id])),\n",[577,2839,2841,2844,2846,2848,2851,2853,2855,2858,2860,2862],{"class":579,"line":2840},24,[577,2842,2843],{"class":605},"    countryIdByIso2: ",[577,2845,2813],{"class":591},[577,2847,2816],{"class":2476},[577,2849,2850],{"class":605},"(countries.",[577,2852,2822],{"class":2476},[577,2854,2825],{"class":605},[577,2856,2857],{"class":583},"c",[577,2859,2831],{"class":605},[577,2861,2834],{"class":591},[577,2863,2864],{"class":605}," [c.iso2, c._id])),\n",[577,2866,2868,2871,2873,2875,2878,2880,2882,2885,2887,2889],{"class":579,"line":2867},25,[577,2869,2870],{"class":605},"    gradeIdByName: ",[577,2872,2813],{"class":591},[577,2874,2816],{"class":2476},[577,2876,2877],{"class":605},"(grades.",[577,2879,2822],{"class":2476},[577,2881,2825],{"class":605},[577,2883,2884],{"class":583},"g",[577,2886,2831],{"class":605},[577,2888,2834],{"class":591},[577,2890,2891],{"class":605}," [g.name, g._id])),\n",[577,2893,2895],{"class":579,"line":2894},26,[577,2896,2897],{"class":605},"  };\n",[577,2899,2901],{"class":579,"line":2900},27,[577,2902,887],{"class":605},[577,2904,2906],{"class":579,"line":2905},28,[577,2907,2465],{"emptyLinePlaceholder":2464},[577,2909,2911],{"class":579,"line":2910},29,[577,2912,2914],{"class":2913},"sLBg1","\u002F\u002F const ref = await loadReferenceData(token);\n",[577,2916,2918,2921],{"class":579,"line":2917},30,[577,2919,2920],{"class":2913},"\u002F\u002F ref.organizationIdBySlug.get('stem')",[577,2922,2923],{"class":2913},"  \u002F\u002F \"64b7f0c2a1e4d93b5c2f1a02\"\n",[577,2925,2927,2930],{"class":579,"line":2926},31,[577,2928,2929],{"class":2913},"\u002F\u002F ref.countryIdByIso2.get('AL')",[577,2931,2932],{"class":2913},"         \u002F\u002F \"630e0182c53dc79a6836e67e\"\n",[568,2934,2938],{"className":2935,"code":2936,"filename":311,"language":2937,"meta":573,"style":573},"language-php shiki shiki-themes github-light-high-contrast github-dark-high-contrast","\u003C?php\nconst MT_BASE = 'https:\u002F\u002Fapi.main-team.org\u002Fv1';\n\nfunction mt_get_all(string $path, string $token): array\n{\n    $items = [];\n    for ($page = 1; ; $page++) {\n        $ch = curl_init(MT_BASE . $path . '?page=' . $page . '&limit=100');\n        curl_setopt_array($ch, [\n            CURLOPT_RETURNTRANSFER => true,\n            CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $token],\n            CURLOPT_TIMEOUT => 30,\n        ]);\n        $raw = curl_exec($ch);\n        $status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);\n        curl_close($ch);\n        if ($raw === false || $status !== 200) {\n            throw new RuntimeException(\"$path: HTTP $status\");\n        }\n        $body = json_decode($raw, true);\n        array_push($items, ...$body['data']);\n        if ($page >= $body['pagination']['totalPages']) {\n            return $items;\n        }\n    }\n}\n\nfunction mt_load_reference_data(string $token): array\n{\n    $organizations = mt_get_all('\u002Forganization', $token);\n    $countries = mt_get_all('\u002Fcountry', $token);\n    $grades = mt_get_all('\u002Fgrade', $token);\n\n    return [\n        'organizationIdBySlug' => array_column($organizations, '_id', 'slug'),\n        'countryIdByIso2' => array_column($countries, '_id', 'iso2'),\n        'gradeIdByName' => array_column($grades, '_id', 'name'),\n    ];\n}\n\n\u002F\u002F $ref = mt_load_reference_data($token);\n\u002F\u002F $ref['organizationIdBySlug']['stem']; \u002F\u002F \"64b7f0c2a1e4d93b5c2f1a02\"\n","php",[392,2939,2940,2948,2961,2965,2991,2995,3004,3023,3061,3069,3082,3099,3111,3116,3129,3147,3154,3182,3210,3215,3232,3251,3274,3282,3286,3290,3294,3298,3315,3319,3335,3350,3366,3371,3380,3405,3427,3449,3455,3460,3465,3471],{"__ignoreMap":573},[577,2941,2942,2945],{"class":579,"line":580},[577,2943,2944],{"class":591},"\u003C?",[577,2946,2947],{"class":598},"php\n",[577,2949,2950,2952,2955,2957,2959],{"class":579,"line":595},[577,2951,2447],{"class":591},[577,2953,2954],{"class":598}," MT_BASE",[577,2956,2453],{"class":591},[577,2958,2456],{"class":587},[577,2960,2459],{"class":605},[577,2962,2963],{"class":579,"line":639},[577,2964,2465],{"emptyLinePlaceholder":2464},[577,2966,2967,2970,2973,2975,2977,2980,2982,2985,2988],{"class":579,"line":652},[577,2968,2969],{"class":591},"function",[577,2971,2972],{"class":2476}," mt_get_all",[577,2974,2480],{"class":605},[577,2976,947],{"class":591},[577,2978,2979],{"class":605}," $path, ",[577,2981,947],{"class":591},[577,2983,2984],{"class":605}," $token)",[577,2986,2987],{"class":591},":",[577,2989,2990],{"class":591}," array\n",[577,2992,2993],{"class":579,"line":661},[577,2994,621],{"class":605},[577,2996,2997,3000,3002],{"class":579,"line":667},[577,2998,2999],{"class":605},"    $items ",[577,3001,2521],{"class":591},[577,3003,2504],{"class":605},[577,3005,3006,3009,3012,3014,3016,3019,3021],{"class":579,"line":680},[577,3007,3008],{"class":591},"    for",[577,3010,3011],{"class":605}," ($page ",[577,3013,2521],{"class":591},[577,3015,2524],{"class":598},[577,3017,3018],{"class":605},"; ; $page",[577,3020,2530],{"class":591},[577,3022,2491],{"class":605},[577,3024,3025,3028,3030,3033,3035,3038,3041,3044,3046,3049,3051,3054,3056,3059],{"class":579,"line":693},[577,3026,3027],{"class":605},"        $ch ",[577,3029,2521],{"class":591},[577,3031,3032],{"class":598}," curl_init",[577,3034,2480],{"class":605},[577,3036,3037],{"class":598},"MT_BASE",[577,3039,3040],{"class":591}," .",[577,3042,3043],{"class":605}," $path ",[577,3045,479],{"class":591},[577,3047,3048],{"class":587}," '?page='",[577,3050,3040],{"class":591},[577,3052,3053],{"class":605}," $page ",[577,3055,479],{"class":591},[577,3057,3058],{"class":587}," '&limit=100'",[577,3060,2637],{"class":605},[577,3062,3063,3066],{"class":579,"line":706},[577,3064,3065],{"class":598},"        curl_setopt_array",[577,3067,3068],{"class":605},"($ch, [\n",[577,3070,3071,3074,3077,3080],{"class":579,"line":719},[577,3072,3073],{"class":598},"            CURLOPT_RETURNTRANSFER",[577,3075,3076],{"class":591}," =>",[577,3078,3079],{"class":598}," true",[577,3081,636],{"class":605},[577,3083,3084,3087,3089,3091,3094,3096],{"class":579,"line":732},[577,3085,3086],{"class":598},"            CURLOPT_HTTPHEADER",[577,3088,3076],{"class":591},[577,3090,2729],{"class":605},[577,3092,3093],{"class":587},"'Authorization: Bearer '",[577,3095,3040],{"class":591},[577,3097,3098],{"class":605}," $token],\n",[577,3100,3101,3104,3106,3109],{"class":579,"line":743},[577,3102,3103],{"class":598},"            CURLOPT_TIMEOUT",[577,3105,3076],{"class":591},[577,3107,3108],{"class":598}," 30",[577,3110,636],{"class":605},[577,3112,3113],{"class":579,"line":749},[577,3114,3115],{"class":605},"        ]);\n",[577,3117,3118,3121,3123,3126],{"class":579,"line":754},[577,3119,3120],{"class":605},"        $raw ",[577,3122,2521],{"class":591},[577,3124,3125],{"class":598}," curl_exec",[577,3127,3128],{"class":605},"($ch);\n",[577,3130,3131,3134,3136,3139,3142,3145],{"class":579,"line":766},[577,3132,3133],{"class":605},"        $status ",[577,3135,2521],{"class":591},[577,3137,3138],{"class":598}," curl_getinfo",[577,3140,3141],{"class":605},"($ch, ",[577,3143,3144],{"class":598},"CURLINFO_RESPONSE_CODE",[577,3146,2637],{"class":605},[577,3148,3149,3152],{"class":579,"line":778},[577,3150,3151],{"class":598},"        curl_close",[577,3153,3128],{"class":605},[577,3155,3156,3159,3162,3165,3168,3171,3174,3177,3180],{"class":579,"line":790},[577,3157,3158],{"class":591},"        if",[577,3160,3161],{"class":605}," ($raw ",[577,3163,3164],{"class":591},"===",[577,3166,3167],{"class":598}," false",[577,3169,3170],{"class":591}," ||",[577,3172,3173],{"class":605}," $status ",[577,3175,3176],{"class":591},"!==",[577,3178,3179],{"class":598}," 200",[577,3181,2491],{"class":605},[577,3183,3184,3187,3189,3192,3194,3197,3200,3203,3206,3208],{"class":579,"line":802},[577,3185,3186],{"class":591},"            throw",[577,3188,2612],{"class":591},[577,3190,3191],{"class":598}," RuntimeException",[577,3193,2480],{"class":605},[577,3195,3196],{"class":587},"\"",[577,3198,3199],{"class":605},"$path",[577,3201,3202],{"class":587},": HTTP ",[577,3204,3205],{"class":605},"$status",[577,3207,3196],{"class":587},[577,3209,2637],{"class":605},[577,3211,3212],{"class":579,"line":813},[577,3213,3214],{"class":605},"        }\n",[577,3216,3217,3220,3222,3225,3228,3230],{"class":579,"line":822},[577,3218,3219],{"class":605},"        $body ",[577,3221,2521],{"class":591},[577,3223,3224],{"class":598}," json_decode",[577,3226,3227],{"class":605},"($raw, ",[577,3229,633],{"class":598},[577,3231,2637],{"class":605},[577,3233,3234,3237,3240,3242,3245,3248],{"class":579,"line":828},[577,3235,3236],{"class":598},"        array_push",[577,3238,3239],{"class":605},"($items, ",[577,3241,2669],{"class":591},[577,3243,3244],{"class":605},"$body[",[577,3246,3247],{"class":587},"'data'",[577,3249,3250],{"class":605},"]);\n",[577,3252,3253,3255,3257,3259,3262,3265,3268,3271],{"class":579,"line":834},[577,3254,3158],{"class":591},[577,3256,3011],{"class":605},[577,3258,2682],{"class":591},[577,3260,3261],{"class":605}," $body[",[577,3263,3264],{"class":587},"'pagination'",[577,3266,3267],{"class":605},"][",[577,3269,3270],{"class":587},"'totalPages'",[577,3272,3273],{"class":605},"]) {\n",[577,3275,3276,3279],{"class":579,"line":884},[577,3277,3278],{"class":591},"            return",[577,3280,3281],{"class":605}," $items;\n",[577,3283,3284],{"class":579,"line":2840},[577,3285,3214],{"class":605},[577,3287,3288],{"class":579,"line":2867},[577,3289,825],{"class":605},[577,3291,3292],{"class":579,"line":2894},[577,3293,887],{"class":605},[577,3295,3296],{"class":579,"line":2900},[577,3297,2465],{"emptyLinePlaceholder":2464},[577,3299,3300,3302,3305,3307,3309,3311,3313],{"class":579,"line":2905},[577,3301,2969],{"class":591},[577,3303,3304],{"class":2476}," mt_load_reference_data",[577,3306,2480],{"class":605},[577,3308,947],{"class":591},[577,3310,2984],{"class":605},[577,3312,2987],{"class":591},[577,3314,2990],{"class":591},[577,3316,3317],{"class":579,"line":2910},[577,3318,621],{"class":605},[577,3320,3321,3324,3326,3328,3330,3332],{"class":579,"line":2917},[577,3322,3323],{"class":605},"    $organizations ",[577,3325,2521],{"class":591},[577,3327,2972],{"class":2476},[577,3329,2480],{"class":605},[577,3331,2767],{"class":587},[577,3333,3334],{"class":605},", $token);\n",[577,3336,3337,3340,3342,3344,3346,3348],{"class":579,"line":2926},[577,3338,3339],{"class":605},"    $countries ",[577,3341,2521],{"class":591},[577,3343,2972],{"class":2476},[577,3345,2480],{"class":605},[577,3347,2779],{"class":587},[577,3349,3334],{"class":605},[577,3351,3353,3356,3358,3360,3362,3364],{"class":579,"line":3352},32,[577,3354,3355],{"class":605},"    $grades ",[577,3357,2521],{"class":591},[577,3359,2972],{"class":2476},[577,3361,2480],{"class":605},[577,3363,2790],{"class":587},[577,3365,3334],{"class":605},[577,3367,3369],{"class":579,"line":3368},33,[577,3370,2465],{"emptyLinePlaceholder":2464},[577,3372,3374,3377],{"class":579,"line":3373},34,[577,3375,3376],{"class":591},"    return",[577,3378,3379],{"class":605}," [\n",[577,3381,3383,3386,3388,3391,3394,3397,3399,3402],{"class":579,"line":3382},35,[577,3384,3385],{"class":587},"        'organizationIdBySlug'",[577,3387,3076],{"class":591},[577,3389,3390],{"class":598}," array_column",[577,3392,3393],{"class":605},"($organizations, ",[577,3395,3396],{"class":587},"'_id'",[577,3398,406],{"class":605},[577,3400,3401],{"class":587},"'slug'",[577,3403,3404],{"class":605},"),\n",[577,3406,3408,3411,3413,3415,3418,3420,3422,3425],{"class":579,"line":3407},36,[577,3409,3410],{"class":587},"        'countryIdByIso2'",[577,3412,3076],{"class":591},[577,3414,3390],{"class":598},[577,3416,3417],{"class":605},"($countries, ",[577,3419,3396],{"class":587},[577,3421,406],{"class":605},[577,3423,3424],{"class":587},"'iso2'",[577,3426,3404],{"class":605},[577,3428,3430,3433,3435,3437,3440,3442,3444,3447],{"class":579,"line":3429},37,[577,3431,3432],{"class":587},"        'gradeIdByName'",[577,3434,3076],{"class":591},[577,3436,3390],{"class":598},[577,3438,3439],{"class":605},"($grades, ",[577,3441,3396],{"class":587},[577,3443,406],{"class":605},[577,3445,3446],{"class":587},"'name'",[577,3448,3404],{"class":605},[577,3450,3452],{"class":579,"line":3451},38,[577,3453,3454],{"class":605},"    ];\n",[577,3456,3458],{"class":579,"line":3457},39,[577,3459,887],{"class":605},[577,3461,3463],{"class":579,"line":3462},40,[577,3464,2465],{"emptyLinePlaceholder":2464},[577,3466,3468],{"class":579,"line":3467},41,[577,3469,3470],{"class":2913},"\u002F\u002F $ref = mt_load_reference_data($token);\n",[577,3472,3474,3477],{"class":579,"line":3473},42,[577,3475,3476],{"class":2913},"\u002F\u002F $ref['organizationIdBySlug']['stem'];",[577,3478,3479],{"class":2913}," \u002F\u002F \"64b7f0c2a1e4d93b5c2f1a02\"\n",[357,3481,3482,3483,3485,3486,3489],{},"When a list is empty, ",[392,3484,2434],{}," is ",[392,3487,3488],{},"0",". Both loops stop after the first page either way.",[460,3491,3493],{"id":3492},"related","Related",[2410,3495,3496,3510,3517],{},[2413,3497,3498,3500,3501,406,3503,406,3505,1034,3507,3509],{},[397,3499,62],{"href":63},": how ",[392,3502,394],{},[392,3504,419],{},[392,3506,1190],{},[392,3508,1193],{}," are resolved when you\nregister or update a student.",[2413,3511,3512,3514,3515,479],{},[397,3513,22],{"href":23},": the core record, the five olympiads and ",[392,3516,437],{},[2413,3518,3519,1034,3521,479],{},[397,3520,39],{"href":40},[397,3522,45],{"href":46},[3524,3525,3526],"style",{},"html pre.shiki code .soyes, html code.shiki .soyes{--shiki-default:#702C00;--shiki-dark:#FFB757}html pre.shiki code .sT6z2, html code.shiki .sT6z2{--shiki-default:#032563;--shiki-dark:#ADDCFF}html pre.shiki code .sHUrx, html code.shiki .sHUrx{--shiki-default:#A0111F;--shiki-dark:#FF9492}html pre.shiki code .s-5SL, html code.shiki .s-5SL{--shiki-default:#023B95;--shiki-dark:#91CBFF}html pre.shiki code .suds8, html code.shiki .suds8{--shiki-default:#0E1116;--shiki-dark:#F0F3F6}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sne4z, html code.shiki .sne4z{--shiki-default:#024C1A;--shiki-dark:#72F088}html pre.shiki code .sKwhi, html code.shiki .sKwhi{--shiki-default:#622CBC;--shiki-dark:#DBB7FF}html pre.shiki code .sLBg1, html code.shiki .sLBg1{--shiki-default:#66707B;--shiki-dark:#BDC4CC}",{"title":573,"searchDepth":595,"depth":639,"links":3528},[3529,3530,3536,3542,3548,3549,3550,3551],{"id":462,"depth":595,"text":25},{"id":562,"depth":595,"text":387,"children":3531},[3532,3533,3534],{"id":566,"depth":639,"text":405},{"id":1040,"depth":639,"text":1041},{"id":1178,"depth":639,"text":3535},"Why country takes an id and nothing else",{"id":1209,"depth":595,"text":414,"children":3537},[3538,3539,3540,3541],{"id":1212,"depth":639,"text":425},{"id":1484,"depth":639,"text":1485},{"id":1497,"depth":639,"text":1498},{"id":1531,"depth":639,"text":1532},{"id":1641,"depth":595,"text":22,"children":3543},[3544,3545,3547],{"id":1644,"depth":639,"text":447},{"id":2032,"depth":639,"text":3546},"Use the _id, never the slug",{"id":2153,"depth":639,"text":2154},{"id":2287,"depth":595,"text":2288},{"id":2379,"depth":595,"text":2380},{"id":2400,"depth":595,"text":2401},{"id":3492,"depth":595,"text":3493},"Look up countries, grades and organizations, the ids that student registration and every organization route depend on.","md",{},[3556,3557,3558,3559,3560,3561],"listCountries","getCountry","listGrades","getGrade","listOrganizations","getOrganization","40",{"title":74,"description":3552},"api\u002Fguides\u002Freference-data","hYct7PLjFVazp4819OT1nlu3pDkWmf0GXEJxv6pkUAE",[3567,3571,3574,3577,3580,3583],{"operationId":3556,"slug":566,"method":133,"path":3568,"tag":74,"summary":149,"deprecated":134,"public":134,"permission":3569,"scope":3570,"order":652},"\u002Fv1\u002Fcountry","country\u002Fread:$org:$ID","flat",{"operationId":3557,"slug":3572,"method":133,"path":3573,"tag":74,"summary":152,"deprecated":134,"public":134,"permission":3569,"scope":3570,"order":661},"get-country","\u002Fv1\u002Fcountry\u002F{id}",{"operationId":3558,"slug":1212,"method":133,"path":3575,"tag":74,"summary":155,"deprecated":134,"public":134,"permission":3576,"scope":3570,"order":667},"\u002Fv1\u002Fgrade","grade\u002Fread:$org:$ID",{"operationId":3559,"slug":3578,"method":133,"path":3579,"tag":74,"summary":158,"deprecated":134,"public":134,"permission":3576,"scope":3570,"order":680},"get-grade","\u002Fv1\u002Fgrade\u002F{id}",{"operationId":3560,"slug":1644,"method":133,"path":3581,"tag":74,"summary":161,"deprecated":134,"public":134,"permission":3582,"scope":3570,"order":693},"\u002Fv1\u002Forganization","organization\u002Fread:$org:$ID",{"operationId":3561,"slug":3584,"method":133,"path":3585,"tag":74,"summary":164,"deprecated":134,"public":134,"permission":3582,"scope":3570,"order":706},"get-organization","\u002Fv1\u002Forganization\u002F{id}",1791554615076]