[{"data":1,"prerenderedAt":3422},["ShallowReactive",2],{"api-nav":3,"api-guide:\u002Fapi\u002Fpagination":351,"api-spec:guide:\u002Fapi\u002Fpagination":3374},[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":39,"body":353,"description":3366,"extension":3367,"meta":3368,"navTitle":39,"navigation":1425,"operations":3369,"order":3370,"path":40,"section":29,"seo":3371,"status":14,"stem":3372,"__hash__":3373},"apiGuides\u002Fapi\u002Fpagination.md",{"type":354,"value":355,"toc":3357},"minimark",[356,369,374,572,578,581,602,606,664,710,717,840,847,851,862,888,891,1177,1234,1237,1290,1294,1303,1313,1596,1603,2288,2291,3098,3102,3108,3129,3132,3171,3177,3181,3186,3265,3269,3278,3344,3353],[357,358,359,360,364,365,368],"p",{},"Every list operation returns its results one page at a time. You choose the page with ",[361,362,363],"code",{},"page"," and its size with ",[361,366,367],{},"limit",", and every list response tells you how many records and pages there are in total. This page explains the rules, shows loops that fetch everything, and covers what to watch for when the data changes while you page.",[370,371,373],"h2",{"id":372},"which-operations-are-paginated","Which operations are paginated",[375,376,377,393],"table",{},[378,379,380],"thead",{},[381,382,383,387,390],"tr",{},[384,385,386],"th",{},"Operation",[384,388,389],{},"Path",[384,391,392],{},"Order of results",[394,395,396,413,428,442,456,470,484,502,516,530,544,558],"tbody",{},[381,397,398,405,410],{},[399,400,401],"td",{},[402,403,404],"a",{"href":150},"listCountries",[399,406,407],{},[361,408,409],{},"GET \u002Fv1\u002Fcountry",[399,411,412],{},"No fixed order",[381,414,415,420,425],{},[399,416,417],{},[402,418,419],{"href":156},"listGrades",[399,421,422],{},[361,423,424],{},"GET \u002Fv1\u002Fgrade",[399,426,427],{},"The platform's own grade order (oldest record first), not alphabetical",[381,429,430,435,440],{},[399,431,432],{},[402,433,434],{"href":162},"listOrganizations",[399,436,437],{},[361,438,439],{},"GET \u002Fv1\u002Forganization",[399,441,412],{},[381,443,444,449,454],{},[399,445,446],{},[402,447,448],{"href":171},"listStudents",[399,450,451],{},[361,452,453],{},"GET \u002Fv1\u002Fstudent",[399,455,412],{},[381,457,458,463,468],{},[399,459,460],{},[402,461,462],{"href":196},"listOrgStudents",[399,464,465],{},[361,466,467],{},"GET \u002Fv1\u002F\u003CorganizationId>\u002Fstudent",[399,469,412],{},[381,471,472,477,482],{},[399,473,474],{},[402,475,476],{"href":220},"listExamCategories",[399,478,479],{},[361,480,481],{},"GET \u002Fv1\u002F\u003CorganizationId>\u002Fexam-category",[399,483,412],{},[381,485,486,491,496],{},[399,487,488],{},[402,489,490],{"href":217},"listExams",[399,492,493],{},[361,494,495],{},"GET \u002Fv1\u002F\u003CorganizationId>\u002Fexam",[399,497,498,499],{},"Soonest sitting first, then by ",[361,500,501],{},"_id",[381,503,504,509,514],{},[399,505,506],{},[402,507,508],{"href":235},"listApplications",[399,510,511],{},[361,512,513],{},"GET \u002Fv1\u002F\u003CorganizationId>\u002Fapplication",[399,515,412],{},[381,517,518,523,528],{},[399,519,520],{},[402,521,522],{"href":241},"listExamApplications",[399,524,525],{},[361,526,527],{},"GET \u002Fv1\u002F\u003CorganizationId>\u002Fapplication\u002Fexam-applications\u002F\u003CexamId>",[399,529,412],{},[381,531,532,537,542],{},[399,533,534],{},[402,535,536],{"href":244},"listStudentApplications",[399,538,539],{},[361,540,541],{},"GET \u002Fv1\u002F\u003CorganizationId>\u002Fapplication\u002Fstudent-applications\u002F\u003CstudentId>",[399,543,412],{},[381,545,546,551,556],{},[399,547,548],{},[402,549,550],{"href":264},"listStudentCertificates",[399,552,553],{},[361,554,555],{},"GET \u002Fv1\u002F\u003CorganizationId>\u002Fcertificate\u002F\u003CuserId>",[399,557,412],{},[381,559,560,565,570],{},[399,561,562],{},[402,563,564],{"href":270},"listStudentReports",[399,566,567],{},[361,568,569],{},"GET \u002Fv1\u002F\u003CorganizationId>\u002Freport\u002F\u003CuserId>",[399,571,412],{},[357,573,574,575,577],{},"\"No fixed order\" means exactly that: do not rely on a record's position, and do not assume the newest record comes first or last. Identify records by ",[361,576,501],{},".",[357,579,580],{},"Not paginated:",[582,583,584,596],"ul",{},[585,586,587,591,592,595],"li",{},[588,589,590],"strong",{},"The exam picker",", ",[402,593,594],{"href":226},"listAvailableExams",". One student's options are a small tree (category, then sitting, then language), so it comes back whole in one response.",[585,597,598,601],{},[588,599,600],{},"Single reads and downloads."," They return one record or one file.",[370,603,605],{"id":604},"the-two-parameters","The two parameters",[375,607,608,624],{},[378,609,610],{},[381,611,612,615,618,621],{},[384,613,614],{},"Parameter",[384,616,617],{},"Default",[384,619,620],{},"Smallest",[384,622,623],{},"Largest",[394,625,626,644],{},[381,627,628,632,637,641],{},[399,629,630],{},[361,631,363],{},[399,633,634],{},[361,635,636],{},"1",[399,638,639],{},[361,640,636],{},[399,642,643],{},"No upper limit. A page past the end is simply empty",[381,645,646,650,655,659],{},[399,647,648],{},[361,649,367],{},[399,651,652],{},[361,653,654],{},"20",[399,656,657],{},[361,658,636],{},[399,660,661],{},[361,662,663],{},"100",[665,666,671],"pre",{"className":667,"code":668,"language":669,"meta":670,"style":670},"language-bash shiki shiki-themes github-light-high-contrast github-dark-high-contrast","curl -sS \"https:\u002F\u002Fapi.main-team.org\u002Fv1\u002Fstudent?page=2&limit=100\" \\\n  -H \"Authorization: Bearer $TOKEN\"\n","bash","",[361,672,673,694],{"__ignoreMap":670},[674,675,678,682,686,690],"span",{"class":676,"line":677},"line",1,[674,679,681],{"class":680},"soyes","curl",[674,683,685],{"class":684},"s-5SL"," -sS",[674,687,689],{"class":688},"sT6z2"," \"https:\u002F\u002Fapi.main-team.org\u002Fv1\u002Fstudent?page=2&limit=100\"",[674,691,693],{"class":692},"sHUrx"," \\\n",[674,695,697,700,703,707],{"class":676,"line":696},2,[674,698,699],{"class":684},"  -H",[674,701,702],{"class":688}," \"Authorization: Bearer ",[674,704,706],{"class":705},"suds8","$TOKEN",[674,708,709],{"class":688},"\"\n",[357,711,712,713,716],{},"The API is forgiving with both parameters. It never answers ",[361,714,715],{},"400"," for them. It uses the nearest value it can:",[375,718,719,732],{},[378,720,721],{},[381,722,723,726,729],{},[384,724,725],{},"You send",[384,727,728],{},"The API uses",[384,730,731],{},"Why",[394,733,734,750,765,784,798,813,827],{},[381,735,736,739,747],{},[399,737,738],{},"Nothing",[399,740,741,591,744],{},[361,742,743],{},"page=1",[361,745,746],{},"limit=20",[399,748,749],{},"Defaults",[381,751,752,757,762],{},[399,753,754],{},[361,755,756],{},"limit=500",[399,758,759],{},[361,760,761],{},"limit=100",[399,763,764],{},"Capped at the largest",[381,766,767,776,781],{},[399,768,769,772,773],{},[361,770,771],{},"limit=0"," or ",[361,774,775],{},"limit=-5",[399,777,778],{},[361,779,780],{},"limit=1",[399,782,783],{},"Raised to the smallest",[381,785,786,791,795],{},[399,787,788],{},[361,789,790],{},"limit=abc",[399,792,793],{},[361,794,746],{},[399,796,797],{},"Not a number, so the default",[381,799,800,805,810],{},[399,801,802],{},[361,803,804],{},"limit=10.9",[399,806,807],{},[361,808,809],{},"limit=10",[399,811,812],{},"Whole numbers only; the fraction is dropped",[381,814,815,820,824],{},[399,816,817],{},[361,818,819],{},"limit=1e2",[399,821,822],{},[361,823,780],{},[399,825,826],{},"Only the leading digits are read, so write numbers out in full",[381,828,829,834,838],{},[399,830,831],{},[361,832,833],{},"page=0",[399,835,836],{},[361,837,743],{},[399,839,783],{},[357,841,842,843,846],{},"Because a bad value is corrected silently, check ",[361,844,845],{},"pagination.limit"," in the response if you are not sure what you asked for. It always shows the values the API actually used.",[370,848,850],{"id":849},"the-pagination-object","The pagination object",[357,852,853,854,857,858,861],{},"Every list response carries a ",[361,855,856],{},"pagination"," object next to ",[361,859,860],{},"data",":",[665,863,865],{"className":667,"code":864,"language":669,"meta":670,"style":670},"curl -sS \"https:\u002F\u002Fapi.main-team.org\u002Fv1\u002Fstudent?page=2&limit=2\" \\\n  -H \"Authorization: Bearer $TOKEN\"\n",[361,866,867,878],{"__ignoreMap":670},[674,868,869,871,873,876],{"class":676,"line":677},[674,870,681],{"class":680},[674,872,685],{"class":684},[674,874,875],{"class":688}," \"https:\u002F\u002Fapi.main-team.org\u002Fv1\u002Fstudent?page=2&limit=2\"",[674,877,693],{"class":692},[674,879,880,882,884,886],{"class":676,"line":696},[674,881,699],{"class":684},[674,883,702],{"class":688},[674,885,706],{"class":705},[674,887,709],{"class":688},[357,889,890],{},"This response shows each student with only a few of its fields:",[665,892,896],{"className":893,"code":894,"language":895,"meta":670,"style":670},"language-json shiki shiki-themes github-light-high-contrast github-dark-high-contrast","{\n  \"success\": true,\n  \"message\": \"Students fetched successfully.\",\n  \"data\": [\n    {\n      \"_id\": \"652f1c9b8e4b2a0012a3c4d5\",\n      \"username\": \"XXK1042\",\n      \"firstName\": \"Jane\",\n      \"lastName\": \"Doe\",\n      \"grade\": { \"_id\": \"5f1a2b3c4d5e6f7a8b9c0d1e\", \"name\": \"10\" }\n    },\n    {\n      \"_id\": \"652f1c9b8e4b2a0012a3c4d6\",\n      \"username\": \"XXB1043\",\n      \"firstName\": \"Arben\",\n      \"lastName\": \"Hoxha\",\n      \"grade\": { \"_id\": \"5f1a2b3c4d5e6f7a8b9c0d1f\", \"name\": \"11\" }\n    }\n  ],\n  \"pagination\": { \"page\": 2, \"limit\": 2, \"total\": 7, \"totalPages\": 4 }\n}\n","json",[361,897,898,903,918,931,940,946,959,972,985,998,1028,1034,1039,1051,1063,1075,1087,1112,1118,1124,1171],{"__ignoreMap":670},[674,899,900],{"class":676,"line":677},[674,901,902],{"class":705},"{\n",[674,904,905,909,912,915],{"class":676,"line":696},[674,906,908],{"class":907},"sne4z","  \"success\"",[674,910,911],{"class":705},": ",[674,913,914],{"class":684},"true",[674,916,917],{"class":705},",\n",[674,919,921,924,926,929],{"class":676,"line":920},3,[674,922,923],{"class":907},"  \"message\"",[674,925,911],{"class":705},[674,927,928],{"class":688},"\"Students fetched successfully.\"",[674,930,917],{"class":705},[674,932,934,937],{"class":676,"line":933},4,[674,935,936],{"class":907},"  \"data\"",[674,938,939],{"class":705},": [\n",[674,941,943],{"class":676,"line":942},5,[674,944,945],{"class":705},"    {\n",[674,947,949,952,954,957],{"class":676,"line":948},6,[674,950,951],{"class":907},"      \"_id\"",[674,953,911],{"class":705},[674,955,956],{"class":688},"\"652f1c9b8e4b2a0012a3c4d5\"",[674,958,917],{"class":705},[674,960,962,965,967,970],{"class":676,"line":961},7,[674,963,964],{"class":907},"      \"username\"",[674,966,911],{"class":705},[674,968,969],{"class":688},"\"XXK1042\"",[674,971,917],{"class":705},[674,973,975,978,980,983],{"class":676,"line":974},8,[674,976,977],{"class":907},"      \"firstName\"",[674,979,911],{"class":705},[674,981,982],{"class":688},"\"Jane\"",[674,984,917],{"class":705},[674,986,988,991,993,996],{"class":676,"line":987},9,[674,989,990],{"class":907},"      \"lastName\"",[674,992,911],{"class":705},[674,994,995],{"class":688},"\"Doe\"",[674,997,917],{"class":705},[674,999,1001,1004,1007,1010,1012,1015,1017,1020,1022,1025],{"class":676,"line":1000},10,[674,1002,1003],{"class":907},"      \"grade\"",[674,1005,1006],{"class":705},": { ",[674,1008,1009],{"class":907},"\"_id\"",[674,1011,911],{"class":705},[674,1013,1014],{"class":688},"\"5f1a2b3c4d5e6f7a8b9c0d1e\"",[674,1016,591],{"class":705},[674,1018,1019],{"class":907},"\"name\"",[674,1021,911],{"class":705},[674,1023,1024],{"class":688},"\"10\"",[674,1026,1027],{"class":705}," }\n",[674,1029,1031],{"class":676,"line":1030},11,[674,1032,1033],{"class":705},"    },\n",[674,1035,1037],{"class":676,"line":1036},12,[674,1038,945],{"class":705},[674,1040,1042,1044,1046,1049],{"class":676,"line":1041},13,[674,1043,951],{"class":907},[674,1045,911],{"class":705},[674,1047,1048],{"class":688},"\"652f1c9b8e4b2a0012a3c4d6\"",[674,1050,917],{"class":705},[674,1052,1054,1056,1058,1061],{"class":676,"line":1053},14,[674,1055,964],{"class":907},[674,1057,911],{"class":705},[674,1059,1060],{"class":688},"\"XXB1043\"",[674,1062,917],{"class":705},[674,1064,1066,1068,1070,1073],{"class":676,"line":1065},15,[674,1067,977],{"class":907},[674,1069,911],{"class":705},[674,1071,1072],{"class":688},"\"Arben\"",[674,1074,917],{"class":705},[674,1076,1078,1080,1082,1085],{"class":676,"line":1077},16,[674,1079,990],{"class":907},[674,1081,911],{"class":705},[674,1083,1084],{"class":688},"\"Hoxha\"",[674,1086,917],{"class":705},[674,1088,1090,1092,1094,1096,1098,1101,1103,1105,1107,1110],{"class":676,"line":1089},17,[674,1091,1003],{"class":907},[674,1093,1006],{"class":705},[674,1095,1009],{"class":907},[674,1097,911],{"class":705},[674,1099,1100],{"class":688},"\"5f1a2b3c4d5e6f7a8b9c0d1f\"",[674,1102,591],{"class":705},[674,1104,1019],{"class":907},[674,1106,911],{"class":705},[674,1108,1109],{"class":688},"\"11\"",[674,1111,1027],{"class":705},[674,1113,1115],{"class":676,"line":1114},18,[674,1116,1117],{"class":705},"    }\n",[674,1119,1121],{"class":676,"line":1120},19,[674,1122,1123],{"class":705},"  ],\n",[674,1125,1127,1130,1132,1135,1137,1140,1142,1145,1147,1149,1151,1154,1156,1159,1161,1164,1166,1169],{"class":676,"line":1126},20,[674,1128,1129],{"class":907},"  \"pagination\"",[674,1131,1006],{"class":705},[674,1133,1134],{"class":907},"\"page\"",[674,1136,911],{"class":705},[674,1138,1139],{"class":684},"2",[674,1141,591],{"class":705},[674,1143,1144],{"class":907},"\"limit\"",[674,1146,911],{"class":705},[674,1148,1139],{"class":684},[674,1150,591],{"class":705},[674,1152,1153],{"class":907},"\"total\"",[674,1155,911],{"class":705},[674,1157,1158],{"class":684},"7",[674,1160,591],{"class":705},[674,1162,1163],{"class":907},"\"totalPages\"",[674,1165,911],{"class":705},[674,1167,1168],{"class":684},"4",[674,1170,1027],{"class":705},[674,1172,1174],{"class":676,"line":1173},21,[674,1175,1176],{"class":705},"}\n",[375,1178,1179,1189],{},[378,1180,1181],{},[381,1182,1183,1186],{},[384,1184,1185],{},"Field",[384,1187,1188],{},"Meaning",[394,1190,1191,1200,1209,1219],{},[381,1192,1193,1197],{},[399,1194,1195],{},[361,1196,363],{},[399,1198,1199],{},"The page you received",[381,1201,1202,1206],{},[399,1203,1204],{},[361,1205,367],{},[399,1207,1208],{},"The page size the API used, after any correction",[381,1210,1211,1216],{},[399,1212,1213],{},[361,1214,1215],{},"total",[399,1217,1218],{},"How many records match in total, across all pages",[381,1220,1221,1226],{},[399,1222,1223],{},[361,1224,1225],{},"totalPages",[399,1227,1228,1230,1231,1233],{},[361,1229,1215],{}," divided by ",[361,1232,367],{},", rounded up",[357,1235,1236],{},"Edge cases:",[582,1238,1239,1261,1271],{},[585,1240,1241,1244,1245,1247,1248,591,1251,1247,1253,1256,1257,1247,1259,577],{},[588,1242,1243],{},"Nothing matches."," ",[361,1246,860],{}," is ",[361,1249,1250],{},"[]",[361,1252,1215],{},[361,1254,1255],{},"0"," and ",[361,1258,1225],{},[361,1260,1255],{},[585,1262,1263,1266,1267,1270],{},[588,1264,1265],{},"The last page"," holds whatever is left. With 7 records and ",[361,1268,1269],{},"limit=2",", page 4 has one record.",[585,1272,1273,1276,1277,1280,1281,1284,1285,1256,1287,1289],{},[588,1274,1275],{},"A page past the end",", such as ",[361,1278,1279],{},"page=9"," above, returns ",[361,1282,1283],{},"data: []"," with the same ",[361,1286,1215],{},[361,1288,1225],{},". It is not an error.",[370,1291,1293],{"id":1292},"fetching-every-page","Fetching every page",[357,1295,1296,1297,1299,1300,1302],{},"Use ",[361,1298,761],{}," whenever you want everything: it takes the fewest requests. Keep asking for the next page until you have received page ",[361,1301,1225],{},", and stop early if a page comes back empty.",[357,1304,1305,1306,1312],{},"With curl and ",[402,1307,1311],{"href":1308,"rel":1309},"https:\u002F\u002Fjqlang.github.io\u002Fjq\u002F",[1310],"nofollow","jq",", writing one student per line:",[665,1314,1316],{"className":667,"code":1315,"language":669,"meta":670,"style":670},"page=1\nwhile : ; do\n  resp=$(curl -sS --fail-with-body \\\n    -H \"Authorization: Bearer $TOKEN\" \\\n    \"https:\u002F\u002Fapi.main-team.org\u002Fv1\u002Fstudent?page=$page&limit=100\") || { echo \"$resp\" >&2; exit 1; }\n\n  echo \"$resp\" | jq -c '.data[]' >> students.ndjson\n\n  total_pages=$(echo \"$resp\" | jq '.pagination.totalPages')\n  count=$(echo \"$resp\" | jq '.data | length')\n  if [ \"$count\" -eq 0 ] || [ \"$page\" -ge \"$total_pages\" ]; then break; fi\n  page=$((page + 1))\ndone\n",[361,1317,1318,1328,1342,1361,1375,1421,1427,1456,1460,1487,1513,1571,1591],{"__ignoreMap":670},[674,1319,1320,1322,1325],{"class":676,"line":677},[674,1321,363],{"class":705},[674,1323,1324],{"class":692},"=",[674,1326,1327],{"class":688},"1\n",[674,1329,1330,1333,1336,1339],{"class":676,"line":696},[674,1331,1332],{"class":692},"while",[674,1334,1335],{"class":684}," :",[674,1337,1338],{"class":705}," ; ",[674,1340,1341],{"class":692},"do\n",[674,1343,1344,1347,1349,1352,1354,1356,1359],{"class":676,"line":920},[674,1345,1346],{"class":705},"  resp",[674,1348,1324],{"class":692},[674,1350,1351],{"class":705},"$(",[674,1353,681],{"class":680},[674,1355,685],{"class":684},[674,1357,1358],{"class":684}," --fail-with-body",[674,1360,693],{"class":692},[674,1362,1363,1366,1368,1370,1373],{"class":676,"line":933},[674,1364,1365],{"class":684},"    -H",[674,1367,702],{"class":688},[674,1369,706],{"class":705},[674,1371,1372],{"class":688},"\"",[674,1374,693],{"class":692},[674,1376,1377,1380,1383,1386,1389,1392,1395,1398,1401,1404,1406,1409,1412,1415,1418],{"class":676,"line":942},[674,1378,1379],{"class":688},"    \"https:\u002F\u002Fapi.main-team.org\u002Fv1\u002Fstudent?page=",[674,1381,1382],{"class":705},"$page",[674,1384,1385],{"class":688},"&limit=100\"",[674,1387,1388],{"class":705},") ",[674,1390,1391],{"class":692},"||",[674,1393,1394],{"class":705}," { ",[674,1396,1397],{"class":684},"echo",[674,1399,1400],{"class":688}," \"",[674,1402,1403],{"class":705},"$resp",[674,1405,1372],{"class":688},[674,1407,1408],{"class":692}," >&2",[674,1410,1411],{"class":705},"; ",[674,1413,1414],{"class":684},"exit",[674,1416,1417],{"class":684}," 1",[674,1419,1420],{"class":705},"; }\n",[674,1422,1423],{"class":676,"line":948},[674,1424,1426],{"emptyLinePlaceholder":1425},true,"\n",[674,1428,1429,1432,1434,1436,1438,1441,1444,1447,1450,1453],{"class":676,"line":961},[674,1430,1431],{"class":684},"  echo",[674,1433,1400],{"class":688},[674,1435,1403],{"class":705},[674,1437,1372],{"class":688},[674,1439,1440],{"class":692}," |",[674,1442,1443],{"class":680}," jq",[674,1445,1446],{"class":684}," -c",[674,1448,1449],{"class":688}," '.data[]'",[674,1451,1452],{"class":692}," >>",[674,1454,1455],{"class":688}," students.ndjson\n",[674,1457,1458],{"class":676,"line":974},[674,1459,1426],{"emptyLinePlaceholder":1425},[674,1461,1462,1465,1467,1469,1471,1473,1475,1477,1479,1481,1484],{"class":676,"line":987},[674,1463,1464],{"class":705},"  total_pages",[674,1466,1324],{"class":692},[674,1468,1351],{"class":705},[674,1470,1397],{"class":684},[674,1472,1400],{"class":688},[674,1474,1403],{"class":705},[674,1476,1372],{"class":688},[674,1478,1440],{"class":692},[674,1480,1443],{"class":680},[674,1482,1483],{"class":688}," '.pagination.totalPages'",[674,1485,1486],{"class":705},")\n",[674,1488,1489,1492,1494,1496,1498,1500,1502,1504,1506,1508,1511],{"class":676,"line":1000},[674,1490,1491],{"class":705},"  count",[674,1493,1324],{"class":692},[674,1495,1351],{"class":705},[674,1497,1397],{"class":684},[674,1499,1400],{"class":688},[674,1501,1403],{"class":705},[674,1503,1372],{"class":688},[674,1505,1440],{"class":692},[674,1507,1443],{"class":680},[674,1509,1510],{"class":688}," '.data | length'",[674,1512,1486],{"class":705},[674,1514,1515,1518,1521,1523,1526,1528,1531,1534,1537,1539,1541,1543,1545,1547,1550,1552,1555,1557,1560,1563,1566,1568],{"class":676,"line":1030},[674,1516,1517],{"class":692},"  if",[674,1519,1520],{"class":705}," [ ",[674,1522,1372],{"class":688},[674,1524,1525],{"class":705},"$count",[674,1527,1372],{"class":688},[674,1529,1530],{"class":692}," -eq",[674,1532,1533],{"class":684}," 0",[674,1535,1536],{"class":705}," ] ",[674,1538,1391],{"class":692},[674,1540,1520],{"class":705},[674,1542,1372],{"class":688},[674,1544,1382],{"class":705},[674,1546,1372],{"class":688},[674,1548,1549],{"class":692}," -ge",[674,1551,1400],{"class":688},[674,1553,1554],{"class":705},"$total_pages",[674,1556,1372],{"class":688},[674,1558,1559],{"class":705}," ]; ",[674,1561,1562],{"class":692},"then",[674,1564,1565],{"class":692}," break",[674,1567,1411],{"class":705},[674,1569,1570],{"class":692},"fi\n",[674,1572,1573,1576,1578,1581,1583,1586,1588],{"class":676,"line":1036},[674,1574,1575],{"class":705},"  page",[674,1577,1324],{"class":692},[674,1579,1580],{"class":705},"$((",[674,1582,363],{"class":680},[674,1584,1585],{"class":688}," +",[674,1587,1417],{"class":684},[674,1589,1590],{"class":705},"))\n",[674,1592,1593],{"class":676,"line":1041},[674,1594,1595],{"class":692},"done\n",[357,1597,1598,1599,1602],{},"Node.js (18 or later). An async generator that yields one record at a time and pauses when the operation's ",[402,1600,1601],{"href":46},"rate limit"," budget runs out:",[665,1604,1608],{"className":1605,"code":1606,"language":1607,"meta":670,"style":670},"language-js shiki shiki-themes github-light-high-contrast github-dark-high-contrast","const BASE = process.env.MTO_API_BASE ?? 'https:\u002F\u002Fapi.main-team.org\u002Fv1';\nconst sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));\n\nexport async function* everyRecord(token, path) {\n  for (let page = 1; ; page += 1) {\n    const sep = path.includes('?') ? '&' : '?';\n    const res = await fetch(`${BASE}${path}${sep}page=${page}&limit=100`, {\n      headers: { Authorization: `Bearer ${token}` },\n    });\n\n    if (res.status === 429) {\n      await sleep(Number(res.headers.get('retry-after') ?? 60) * 1000);\n      page -= 1; \u002F\u002F ask for the same page again\n      continue;\n    }\n    const body = await res.json();\n    if (!res.ok) {\n      throw new Error(`${res.status} ${body.error?.code}: ${body.error?.message} (${body.error?.request_id})`);\n    }\n\n    yield* body.data;\n\n    const { totalPages } = body.pagination;\n    if (body.data.length === 0 || page >= totalPages) return;\n\n    \u002F\u002F Out of budget for this operation: wait for the window to reset.\n    if (res.headers.get('x-ratelimit-remaining') === '0') {\n      await sleep(Number(res.headers.get('x-ratelimit-reset') ?? 60) * 1000);\n    }\n  }\n}\n\n\u002F\u002F Usage: every student, then every application on one organization.\nfor await (const student of everyRecord(token, '\u002Fstudent')) {\n  console.log(student._id, student.username);\n}\nfor await (const application of everyRecord(token, `\u002F${organizationId}\u002Fapplication`)) {\n  console.log(application._id, application.user?.mainId);\n}\n","js",[361,1609,1610,1636,1679,1683,1711,1738,1774,1818,1834,1839,1843,1859,1901,1917,1924,1928,1947,1959,2030,2034,2038,2046,2051,2068,2100,2105,2111,2135,2169,2174,2180,2185,2190,2196,2225,2237,2242,2273,2283],{"__ignoreMap":670},[674,1611,1612,1615,1618,1621,1624,1627,1630,1633],{"class":676,"line":677},[674,1613,1614],{"class":692},"const",[674,1616,1617],{"class":684}," BASE",[674,1619,1620],{"class":692}," =",[674,1622,1623],{"class":705}," process.env.",[674,1625,1626],{"class":684},"MTO_API_BASE",[674,1628,1629],{"class":692}," ??",[674,1631,1632],{"class":688}," 'https:\u002F\u002Fapi.main-team.org\u002Fv1'",[674,1634,1635],{"class":705},";\n",[674,1637,1638,1640,1644,1646,1649,1652,1654,1657,1660,1663,1666,1669,1671,1673,1676],{"class":676,"line":696},[674,1639,1614],{"class":692},[674,1641,1643],{"class":1642},"sKwhi"," sleep",[674,1645,1620],{"class":692},[674,1647,1648],{"class":705}," (",[674,1650,1651],{"class":680},"ms",[674,1653,1388],{"class":705},[674,1655,1656],{"class":692},"=>",[674,1658,1659],{"class":692}," new",[674,1661,1662],{"class":684}," Promise",[674,1664,1665],{"class":705},"((",[674,1667,1668],{"class":680},"resolve",[674,1670,1388],{"class":705},[674,1672,1656],{"class":692},[674,1674,1675],{"class":1642}," setTimeout",[674,1677,1678],{"class":705},"(resolve, ms));\n",[674,1680,1681],{"class":676,"line":920},[674,1682,1426],{"emptyLinePlaceholder":1425},[674,1684,1685,1688,1691,1694,1697,1700,1703,1705,1708],{"class":676,"line":933},[674,1686,1687],{"class":692},"export",[674,1689,1690],{"class":692}," async",[674,1692,1693],{"class":692}," function*",[674,1695,1696],{"class":1642}," everyRecord",[674,1698,1699],{"class":705},"(",[674,1701,1702],{"class":680},"token",[674,1704,591],{"class":705},[674,1706,1707],{"class":680},"path",[674,1709,1710],{"class":705},") {\n",[674,1712,1713,1716,1718,1721,1724,1726,1728,1731,1734,1736],{"class":676,"line":942},[674,1714,1715],{"class":692},"  for",[674,1717,1648],{"class":705},[674,1719,1720],{"class":692},"let",[674,1722,1723],{"class":705}," page ",[674,1725,1324],{"class":692},[674,1727,1417],{"class":684},[674,1729,1730],{"class":705},"; ; page ",[674,1732,1733],{"class":692},"+=",[674,1735,1417],{"class":684},[674,1737,1710],{"class":705},[674,1739,1740,1743,1746,1748,1751,1754,1756,1759,1761,1764,1767,1769,1772],{"class":676,"line":948},[674,1741,1742],{"class":692},"    const",[674,1744,1745],{"class":684}," sep",[674,1747,1620],{"class":692},[674,1749,1750],{"class":705}," path.",[674,1752,1753],{"class":1642},"includes",[674,1755,1699],{"class":705},[674,1757,1758],{"class":688},"'?'",[674,1760,1388],{"class":705},[674,1762,1763],{"class":692},"?",[674,1765,1766],{"class":688}," '&'",[674,1768,1335],{"class":692},[674,1770,1771],{"class":688}," '?'",[674,1773,1635],{"class":705},[674,1775,1776,1778,1781,1783,1786,1789,1791,1794,1797,1800,1802,1804,1807,1810,1812,1815],{"class":676,"line":961},[674,1777,1742],{"class":692},[674,1779,1780],{"class":684}," res",[674,1782,1620],{"class":692},[674,1784,1785],{"class":692}," await",[674,1787,1788],{"class":1642}," fetch",[674,1790,1699],{"class":705},[674,1792,1793],{"class":688},"`${",[674,1795,1796],{"class":684},"BASE",[674,1798,1799],{"class":688},"}${",[674,1801,1707],{"class":705},[674,1803,1799],{"class":688},[674,1805,1806],{"class":705},"sep",[674,1808,1809],{"class":688},"}page=${",[674,1811,363],{"class":705},[674,1813,1814],{"class":688},"}&limit=100`",[674,1816,1817],{"class":705},", {\n",[674,1819,1820,1823,1826,1828,1831],{"class":676,"line":974},[674,1821,1822],{"class":705},"      headers: { Authorization: ",[674,1824,1825],{"class":688},"`Bearer ${",[674,1827,1702],{"class":705},[674,1829,1830],{"class":688},"}`",[674,1832,1833],{"class":705}," },\n",[674,1835,1836],{"class":676,"line":987},[674,1837,1838],{"class":705},"    });\n",[674,1840,1841],{"class":676,"line":1000},[674,1842,1426],{"emptyLinePlaceholder":1425},[674,1844,1845,1848,1851,1854,1857],{"class":676,"line":1030},[674,1846,1847],{"class":692},"    if",[674,1849,1850],{"class":705}," (res.status ",[674,1852,1853],{"class":692},"===",[674,1855,1856],{"class":684}," 429",[674,1858,1710],{"class":705},[674,1860,1861,1864,1866,1868,1871,1874,1877,1879,1882,1884,1887,1890,1892,1895,1898],{"class":676,"line":1036},[674,1862,1863],{"class":692},"      await",[674,1865,1643],{"class":1642},[674,1867,1699],{"class":705},[674,1869,1870],{"class":1642},"Number",[674,1872,1873],{"class":705},"(res.headers.",[674,1875,1876],{"class":1642},"get",[674,1878,1699],{"class":705},[674,1880,1881],{"class":688},"'retry-after'",[674,1883,1388],{"class":705},[674,1885,1886],{"class":692},"??",[674,1888,1889],{"class":684}," 60",[674,1891,1388],{"class":705},[674,1893,1894],{"class":692},"*",[674,1896,1897],{"class":684}," 1000",[674,1899,1900],{"class":705},");\n",[674,1902,1903,1906,1909,1911,1913],{"class":676,"line":1041},[674,1904,1905],{"class":705},"      page ",[674,1907,1908],{"class":692},"-=",[674,1910,1417],{"class":684},[674,1912,1411],{"class":705},[674,1914,1916],{"class":1915},"sLBg1","\u002F\u002F ask for the same page again\n",[674,1918,1919,1922],{"class":676,"line":1053},[674,1920,1921],{"class":692},"      continue",[674,1923,1635],{"class":705},[674,1925,1926],{"class":676,"line":1065},[674,1927,1117],{"class":705},[674,1929,1930,1932,1935,1937,1939,1942,1944],{"class":676,"line":1077},[674,1931,1742],{"class":692},[674,1933,1934],{"class":684}," body",[674,1936,1620],{"class":692},[674,1938,1785],{"class":692},[674,1940,1941],{"class":705}," res.",[674,1943,895],{"class":1642},[674,1945,1946],{"class":705},"();\n",[674,1948,1949,1951,1953,1956],{"class":676,"line":1089},[674,1950,1847],{"class":692},[674,1952,1648],{"class":705},[674,1954,1955],{"class":692},"!",[674,1957,1958],{"class":705},"res.ok) {\n",[674,1960,1961,1964,1966,1969,1971,1973,1976,1978,1981,1984,1987,1989,1992,1995,1997,2000,2002,2004,2006,2008,2011,2014,2016,2018,2020,2022,2025,2028],{"class":676,"line":1114},[674,1962,1963],{"class":692},"      throw",[674,1965,1659],{"class":692},[674,1967,1968],{"class":1642}," Error",[674,1970,1699],{"class":705},[674,1972,1793],{"class":688},[674,1974,1975],{"class":705},"res",[674,1977,577],{"class":688},[674,1979,1980],{"class":705},"status",[674,1982,1983],{"class":688},"} ${",[674,1985,1986],{"class":705},"body",[674,1988,577],{"class":688},[674,1990,1991],{"class":705},"error",[674,1993,1994],{"class":688},"?.",[674,1996,361],{"class":705},[674,1998,1999],{"class":688},"}: ${",[674,2001,1986],{"class":705},[674,2003,577],{"class":688},[674,2005,1991],{"class":705},[674,2007,1994],{"class":688},[674,2009,2010],{"class":705},"message",[674,2012,2013],{"class":688},"} (${",[674,2015,1986],{"class":705},[674,2017,577],{"class":688},[674,2019,1991],{"class":705},[674,2021,1994],{"class":688},[674,2023,2024],{"class":705},"request_id",[674,2026,2027],{"class":688},"})`",[674,2029,1900],{"class":705},[674,2031,2032],{"class":676,"line":1120},[674,2033,1117],{"class":705},[674,2035,2036],{"class":676,"line":1126},[674,2037,1426],{"emptyLinePlaceholder":1425},[674,2039,2040,2043],{"class":676,"line":1173},[674,2041,2042],{"class":692},"    yield*",[674,2044,2045],{"class":705}," body.data;\n",[674,2047,2049],{"class":676,"line":2048},22,[674,2050,1426],{"emptyLinePlaceholder":1425},[674,2052,2054,2056,2058,2060,2063,2065],{"class":676,"line":2053},23,[674,2055,1742],{"class":692},[674,2057,1394],{"class":705},[674,2059,1225],{"class":684},[674,2061,2062],{"class":705}," } ",[674,2064,1324],{"class":692},[674,2066,2067],{"class":705}," body.pagination;\n",[674,2069,2071,2073,2076,2079,2082,2084,2087,2089,2092,2095,2098],{"class":676,"line":2070},24,[674,2072,1847],{"class":692},[674,2074,2075],{"class":705}," (body.data.",[674,2077,2078],{"class":684},"length",[674,2080,2081],{"class":692}," ===",[674,2083,1533],{"class":684},[674,2085,2086],{"class":692}," ||",[674,2088,1723],{"class":705},[674,2090,2091],{"class":692},">=",[674,2093,2094],{"class":705}," totalPages) ",[674,2096,2097],{"class":692},"return",[674,2099,1635],{"class":705},[674,2101,2103],{"class":676,"line":2102},25,[674,2104,1426],{"emptyLinePlaceholder":1425},[674,2106,2108],{"class":676,"line":2107},26,[674,2109,2110],{"class":1915},"    \u002F\u002F Out of budget for this operation: wait for the window to reset.\n",[674,2112,2114,2116,2119,2121,2123,2126,2128,2130,2133],{"class":676,"line":2113},27,[674,2115,1847],{"class":692},[674,2117,2118],{"class":705}," (res.headers.",[674,2120,1876],{"class":1642},[674,2122,1699],{"class":705},[674,2124,2125],{"class":688},"'x-ratelimit-remaining'",[674,2127,1388],{"class":705},[674,2129,1853],{"class":692},[674,2131,2132],{"class":688}," '0'",[674,2134,1710],{"class":705},[674,2136,2138,2140,2142,2144,2146,2148,2150,2152,2155,2157,2159,2161,2163,2165,2167],{"class":676,"line":2137},28,[674,2139,1863],{"class":692},[674,2141,1643],{"class":1642},[674,2143,1699],{"class":705},[674,2145,1870],{"class":1642},[674,2147,1873],{"class":705},[674,2149,1876],{"class":1642},[674,2151,1699],{"class":705},[674,2153,2154],{"class":688},"'x-ratelimit-reset'",[674,2156,1388],{"class":705},[674,2158,1886],{"class":692},[674,2160,1889],{"class":684},[674,2162,1388],{"class":705},[674,2164,1894],{"class":692},[674,2166,1897],{"class":684},[674,2168,1900],{"class":705},[674,2170,2172],{"class":676,"line":2171},29,[674,2173,1117],{"class":705},[674,2175,2177],{"class":676,"line":2176},30,[674,2178,2179],{"class":705},"  }\n",[674,2181,2183],{"class":676,"line":2182},31,[674,2184,1176],{"class":705},[674,2186,2188],{"class":676,"line":2187},32,[674,2189,1426],{"emptyLinePlaceholder":1425},[674,2191,2193],{"class":676,"line":2192},33,[674,2194,2195],{"class":1915},"\u002F\u002F Usage: every student, then every application on one organization.\n",[674,2197,2199,2202,2204,2206,2208,2211,2214,2216,2219,2222],{"class":676,"line":2198},34,[674,2200,2201],{"class":692},"for",[674,2203,1785],{"class":692},[674,2205,1648],{"class":705},[674,2207,1614],{"class":692},[674,2209,2210],{"class":684}," student",[674,2212,2213],{"class":692}," of",[674,2215,1696],{"class":1642},[674,2217,2218],{"class":705},"(token, ",[674,2220,2221],{"class":688},"'\u002Fstudent'",[674,2223,2224],{"class":705},")) {\n",[674,2226,2228,2231,2234],{"class":676,"line":2227},35,[674,2229,2230],{"class":705},"  console.",[674,2232,2233],{"class":1642},"log",[674,2235,2236],{"class":705},"(student._id, student.username);\n",[674,2238,2240],{"class":676,"line":2239},36,[674,2241,1176],{"class":705},[674,2243,2245,2247,2249,2251,2253,2256,2258,2260,2262,2265,2268,2271],{"class":676,"line":2244},37,[674,2246,2201],{"class":692},[674,2248,1785],{"class":692},[674,2250,1648],{"class":705},[674,2252,1614],{"class":692},[674,2254,2255],{"class":684}," application",[674,2257,2213],{"class":692},[674,2259,1696],{"class":1642},[674,2261,2218],{"class":705},[674,2263,2264],{"class":688},"`\u002F${",[674,2266,2267],{"class":705},"organizationId",[674,2269,2270],{"class":688},"}\u002Fapplication`",[674,2272,2224],{"class":705},[674,2274,2276,2278,2280],{"class":676,"line":2275},38,[674,2277,2230],{"class":705},[674,2279,2233],{"class":1642},[674,2281,2282],{"class":705},"(application._id, application.user?.mainId);\n",[674,2284,2286],{"class":676,"line":2285},39,[674,2287,1176],{"class":705},[357,2289,2290],{},"PHP (8.1 or later). A generator with the same behavior:",[665,2292,2296],{"className":2293,"code":2294,"language":2295,"meta":670,"style":670},"language-php shiki shiki-themes github-light-high-contrast github-dark-high-contrast","\u003C?php\nfunction everyRecord(string $token, string $path): Generator\n{\n    $base = getenv('MTO_API_BASE') ?: 'https:\u002F\u002Fapi.main-team.org\u002Fv1';\n    $page = 1;\n\n    while (true) {\n        $headers = [];\n        $sep = str_contains($path, '?') ? '&' : '?';\n        $ch = curl_init(\"{$base}{$path}{$sep}page={$page}&limit=100\");\n        curl_setopt_array($ch, [\n            CURLOPT_HTTPHEADER => [\"Authorization: Bearer {$token}\"],\n            CURLOPT_RETURNTRANSFER => true,\n            CURLOPT_TIMEOUT => 30,\n            CURLOPT_HEADERFUNCTION => function ($ch, $line) use (&$headers) {\n                $parts = explode(':', $line, 2);\n                if (count($parts) === 2) {\n                    $headers[strtolower(trim($parts[0]))] = trim($parts[1]);\n                }\n                return strlen($line);\n            },\n        ]);\n        $raw = curl_exec($ch);\n        $status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);\n        curl_close($ch);\n\n        if ($status === 429) {\n            sleep((int) ($headers['retry-after'] ?? 60));\n            continue; \u002F\u002F same page again\n        }\n        $body = json_decode((string) $raw, true);\n        if ($status >= 400) {\n            $e = $body['error'] ?? [];\n            throw new RuntimeException(\"{$status} \" . ($e['code'] ?? '') . ': ' . ($e['message'] ?? '') . ' (' . ($e['request_id'] ?? '-') . ')');\n        }\n\n        yield from $body['data'];\n\n        if (count($body['data']) === 0 || $page >= $body['pagination']['totalPages']) {\n            return;\n        }\n        if (($headers['x-ratelimit-remaining'] ?? null) === '0') {\n            sleep((int) ($headers['x-ratelimit-reset'] ?? 60));\n        }\n        $page++;\n    }\n}\n\n\u002F\u002F Usage\nforeach (everyRecord($token, '\u002Fstudent') as $student) {\n    echo $student['_id'], ' ', $student['username'], PHP_EOL;\n}\n","php",[361,2297,2298,2306,2331,2335,2359,2370,2374,2385,2395,2422,2461,2469,2492,2504,2516,2540,2562,2582,2615,2620,2631,2636,2641,2654,2672,2679,2683,2697,2722,2732,2737,2758,2771,2790,2876,2880,2884,2897,2901,2942,2950,2955,2980,3001,3006,3017,3022,3027,3032,3038,3062,3093],{"__ignoreMap":670},[674,2299,2300,2303],{"class":676,"line":677},[674,2301,2302],{"class":692},"\u003C?",[674,2304,2305],{"class":684},"php\n",[674,2307,2308,2311,2313,2315,2318,2321,2323,2326,2328],{"class":676,"line":696},[674,2309,2310],{"class":692},"function",[674,2312,1696],{"class":1642},[674,2314,1699],{"class":705},[674,2316,2317],{"class":692},"string",[674,2319,2320],{"class":705}," $token, ",[674,2322,2317],{"class":692},[674,2324,2325],{"class":705}," $path)",[674,2327,861],{"class":692},[674,2329,2330],{"class":684}," Generator\n",[674,2332,2333],{"class":676,"line":920},[674,2334,902],{"class":705},[674,2336,2337,2340,2342,2345,2347,2350,2352,2355,2357],{"class":676,"line":933},[674,2338,2339],{"class":705},"    $base ",[674,2341,1324],{"class":692},[674,2343,2344],{"class":684}," getenv",[674,2346,1699],{"class":705},[674,2348,2349],{"class":688},"'MTO_API_BASE'",[674,2351,1388],{"class":705},[674,2353,2354],{"class":692},"?:",[674,2356,1632],{"class":688},[674,2358,1635],{"class":705},[674,2360,2361,2364,2366,2368],{"class":676,"line":942},[674,2362,2363],{"class":705},"    $page ",[674,2365,1324],{"class":692},[674,2367,1417],{"class":684},[674,2369,1635],{"class":705},[674,2371,2372],{"class":676,"line":948},[674,2373,1426],{"emptyLinePlaceholder":1425},[674,2375,2376,2379,2381,2383],{"class":676,"line":961},[674,2377,2378],{"class":692},"    while",[674,2380,1648],{"class":705},[674,2382,914],{"class":684},[674,2384,1710],{"class":705},[674,2386,2387,2390,2392],{"class":676,"line":974},[674,2388,2389],{"class":705},"        $headers ",[674,2391,1324],{"class":692},[674,2393,2394],{"class":705}," [];\n",[674,2396,2397,2400,2402,2405,2408,2410,2412,2414,2416,2418,2420],{"class":676,"line":987},[674,2398,2399],{"class":705},"        $sep ",[674,2401,1324],{"class":692},[674,2403,2404],{"class":684}," str_contains",[674,2406,2407],{"class":705},"($path, ",[674,2409,1758],{"class":688},[674,2411,1388],{"class":705},[674,2413,1763],{"class":692},[674,2415,1766],{"class":688},[674,2417,1335],{"class":692},[674,2419,1771],{"class":688},[674,2421,1635],{"class":705},[674,2423,2424,2427,2429,2432,2434,2437,2440,2443,2446,2448,2451,2454,2456,2459],{"class":676,"line":1000},[674,2425,2426],{"class":705},"        $ch ",[674,2428,1324],{"class":692},[674,2430,2431],{"class":684}," curl_init",[674,2433,1699],{"class":705},[674,2435,2436],{"class":688},"\"{",[674,2438,2439],{"class":705},"$base",[674,2441,2442],{"class":688},"}{",[674,2444,2445],{"class":705},"$path",[674,2447,2442],{"class":688},[674,2449,2450],{"class":705},"$sep",[674,2452,2453],{"class":688},"}page={",[674,2455,1382],{"class":705},[674,2457,2458],{"class":688},"}&limit=100\"",[674,2460,1900],{"class":705},[674,2462,2463,2466],{"class":676,"line":1030},[674,2464,2465],{"class":684},"        curl_setopt_array",[674,2467,2468],{"class":705},"($ch, [\n",[674,2470,2471,2474,2477,2480,2483,2486,2489],{"class":676,"line":1036},[674,2472,2473],{"class":684},"            CURLOPT_HTTPHEADER",[674,2475,2476],{"class":692}," =>",[674,2478,2479],{"class":705}," [",[674,2481,2482],{"class":688},"\"Authorization: Bearer {",[674,2484,2485],{"class":705},"$token",[674,2487,2488],{"class":688},"}\"",[674,2490,2491],{"class":705},"],\n",[674,2493,2494,2497,2499,2502],{"class":676,"line":1041},[674,2495,2496],{"class":684},"            CURLOPT_RETURNTRANSFER",[674,2498,2476],{"class":692},[674,2500,2501],{"class":684}," true",[674,2503,917],{"class":705},[674,2505,2506,2509,2511,2514],{"class":676,"line":1053},[674,2507,2508],{"class":684},"            CURLOPT_TIMEOUT",[674,2510,2476],{"class":692},[674,2512,2513],{"class":684}," 30",[674,2515,917],{"class":705},[674,2517,2518,2521,2523,2526,2529,2532,2534,2537],{"class":676,"line":1065},[674,2519,2520],{"class":684},"            CURLOPT_HEADERFUNCTION",[674,2522,2476],{"class":692},[674,2524,2525],{"class":692}," function",[674,2527,2528],{"class":705}," ($ch, $line) ",[674,2530,2531],{"class":692},"use",[674,2533,1648],{"class":705},[674,2535,2536],{"class":692},"&",[674,2538,2539],{"class":705},"$headers) {\n",[674,2541,2542,2545,2547,2550,2552,2555,2558,2560],{"class":676,"line":1077},[674,2543,2544],{"class":705},"                $parts ",[674,2546,1324],{"class":692},[674,2548,2549],{"class":684}," explode",[674,2551,1699],{"class":705},[674,2553,2554],{"class":688},"':'",[674,2556,2557],{"class":705},", $line, ",[674,2559,1139],{"class":684},[674,2561,1900],{"class":705},[674,2563,2564,2567,2569,2572,2575,2577,2580],{"class":676,"line":1089},[674,2565,2566],{"class":692},"                if",[674,2568,1648],{"class":705},[674,2570,2571],{"class":684},"count",[674,2573,2574],{"class":705},"($parts) ",[674,2576,1853],{"class":692},[674,2578,2579],{"class":684}," 2",[674,2581,1710],{"class":705},[674,2583,2584,2587,2590,2592,2595,2598,2600,2603,2605,2608,2610,2612],{"class":676,"line":1114},[674,2585,2586],{"class":705},"                    $headers[",[674,2588,2589],{"class":684},"strtolower",[674,2591,1699],{"class":705},[674,2593,2594],{"class":684},"trim",[674,2596,2597],{"class":705},"($parts[",[674,2599,1255],{"class":684},[674,2601,2602],{"class":705},"]))] ",[674,2604,1324],{"class":692},[674,2606,2607],{"class":684}," trim",[674,2609,2597],{"class":705},[674,2611,636],{"class":684},[674,2613,2614],{"class":705},"]);\n",[674,2616,2617],{"class":676,"line":1120},[674,2618,2619],{"class":705},"                }\n",[674,2621,2622,2625,2628],{"class":676,"line":1126},[674,2623,2624],{"class":692},"                return",[674,2626,2627],{"class":684}," strlen",[674,2629,2630],{"class":705},"($line);\n",[674,2632,2633],{"class":676,"line":1173},[674,2634,2635],{"class":705},"            },\n",[674,2637,2638],{"class":676,"line":2048},[674,2639,2640],{"class":705},"        ]);\n",[674,2642,2643,2646,2648,2651],{"class":676,"line":2053},[674,2644,2645],{"class":705},"        $raw ",[674,2647,1324],{"class":692},[674,2649,2650],{"class":684}," curl_exec",[674,2652,2653],{"class":705},"($ch);\n",[674,2655,2656,2659,2661,2664,2667,2670],{"class":676,"line":2070},[674,2657,2658],{"class":705},"        $status ",[674,2660,1324],{"class":692},[674,2662,2663],{"class":684}," curl_getinfo",[674,2665,2666],{"class":705},"($ch, ",[674,2668,2669],{"class":684},"CURLINFO_RESPONSE_CODE",[674,2671,1900],{"class":705},[674,2673,2674,2677],{"class":676,"line":2102},[674,2675,2676],{"class":684},"        curl_close",[674,2678,2653],{"class":705},[674,2680,2681],{"class":676,"line":2107},[674,2682,1426],{"emptyLinePlaceholder":1425},[674,2684,2685,2688,2691,2693,2695],{"class":676,"line":2113},[674,2686,2687],{"class":692},"        if",[674,2689,2690],{"class":705}," ($status ",[674,2692,1853],{"class":692},[674,2694,1856],{"class":684},[674,2696,1710],{"class":705},[674,2698,2699,2702,2704,2707,2710,2712,2715,2717,2719],{"class":676,"line":2137},[674,2700,2701],{"class":684},"            sleep",[674,2703,1665],{"class":705},[674,2705,2706],{"class":692},"int",[674,2708,2709],{"class":705},") ($headers[",[674,2711,1881],{"class":688},[674,2713,2714],{"class":705},"] ",[674,2716,1886],{"class":692},[674,2718,1889],{"class":684},[674,2720,2721],{"class":705},"));\n",[674,2723,2724,2727,2729],{"class":676,"line":2171},[674,2725,2726],{"class":692},"            continue",[674,2728,1411],{"class":705},[674,2730,2731],{"class":1915},"\u002F\u002F same page again\n",[674,2733,2734],{"class":676,"line":2176},[674,2735,2736],{"class":705},"        }\n",[674,2738,2739,2742,2744,2747,2749,2751,2754,2756],{"class":676,"line":2182},[674,2740,2741],{"class":705},"        $body ",[674,2743,1324],{"class":692},[674,2745,2746],{"class":684}," json_decode",[674,2748,1665],{"class":705},[674,2750,2317],{"class":692},[674,2752,2753],{"class":705},") $raw, ",[674,2755,914],{"class":684},[674,2757,1900],{"class":705},[674,2759,2760,2762,2764,2766,2769],{"class":676,"line":2187},[674,2761,2687],{"class":692},[674,2763,2690],{"class":705},[674,2765,2091],{"class":692},[674,2767,2768],{"class":684}," 400",[674,2770,1710],{"class":705},[674,2772,2773,2776,2778,2781,2784,2786,2788],{"class":676,"line":2192},[674,2774,2775],{"class":705},"            $e ",[674,2777,1324],{"class":692},[674,2779,2780],{"class":705}," $body[",[674,2782,2783],{"class":688},"'error'",[674,2785,2714],{"class":705},[674,2787,1886],{"class":692},[674,2789,2394],{"class":705},[674,2791,2792,2795,2797,2800,2802,2804,2807,2810,2813,2816,2819,2821,2823,2826,2828,2830,2833,2835,2837,2840,2842,2844,2846,2848,2850,2853,2855,2857,2860,2862,2864,2867,2869,2871,2874],{"class":676,"line":2198},[674,2793,2794],{"class":692},"            throw",[674,2796,1659],{"class":692},[674,2798,2799],{"class":684}," RuntimeException",[674,2801,1699],{"class":705},[674,2803,2436],{"class":688},[674,2805,2806],{"class":705},"$status",[674,2808,2809],{"class":688},"} \"",[674,2811,2812],{"class":692}," .",[674,2814,2815],{"class":705}," ($e[",[674,2817,2818],{"class":688},"'code'",[674,2820,2714],{"class":705},[674,2822,1886],{"class":692},[674,2824,2825],{"class":688}," ''",[674,2827,1388],{"class":705},[674,2829,577],{"class":692},[674,2831,2832],{"class":688}," ': '",[674,2834,2812],{"class":692},[674,2836,2815],{"class":705},[674,2838,2839],{"class":688},"'message'",[674,2841,2714],{"class":705},[674,2843,1886],{"class":692},[674,2845,2825],{"class":688},[674,2847,1388],{"class":705},[674,2849,577],{"class":692},[674,2851,2852],{"class":688}," ' ('",[674,2854,2812],{"class":692},[674,2856,2815],{"class":705},[674,2858,2859],{"class":688},"'request_id'",[674,2861,2714],{"class":705},[674,2863,1886],{"class":692},[674,2865,2866],{"class":688}," '-'",[674,2868,1388],{"class":705},[674,2870,577],{"class":692},[674,2872,2873],{"class":688}," ')'",[674,2875,1900],{"class":705},[674,2877,2878],{"class":676,"line":2227},[674,2879,2736],{"class":705},[674,2881,2882],{"class":676,"line":2239},[674,2883,1426],{"emptyLinePlaceholder":1425},[674,2885,2886,2889,2891,2894],{"class":676,"line":2244},[674,2887,2888],{"class":692},"        yield from",[674,2890,2780],{"class":705},[674,2892,2893],{"class":688},"'data'",[674,2895,2896],{"class":705},"];\n",[674,2898,2899],{"class":676,"line":2275},[674,2900,1426],{"emptyLinePlaceholder":1425},[674,2902,2903,2905,2907,2909,2912,2914,2917,2919,2921,2923,2926,2928,2930,2933,2936,2939],{"class":676,"line":2285},[674,2904,2687],{"class":692},[674,2906,1648],{"class":705},[674,2908,2571],{"class":684},[674,2910,2911],{"class":705},"($body[",[674,2913,2893],{"class":688},[674,2915,2916],{"class":705},"]) ",[674,2918,1853],{"class":692},[674,2920,1533],{"class":684},[674,2922,2086],{"class":692},[674,2924,2925],{"class":705}," $page ",[674,2927,2091],{"class":692},[674,2929,2780],{"class":705},[674,2931,2932],{"class":688},"'pagination'",[674,2934,2935],{"class":705},"][",[674,2937,2938],{"class":688},"'totalPages'",[674,2940,2941],{"class":705},"]) {\n",[674,2943,2945,2948],{"class":676,"line":2944},40,[674,2946,2947],{"class":692},"            return",[674,2949,1635],{"class":705},[674,2951,2953],{"class":676,"line":2952},41,[674,2954,2736],{"class":705},[674,2956,2958,2960,2963,2965,2967,2969,2972,2974,2976,2978],{"class":676,"line":2957},42,[674,2959,2687],{"class":692},[674,2961,2962],{"class":705}," (($headers[",[674,2964,2125],{"class":688},[674,2966,2714],{"class":705},[674,2968,1886],{"class":692},[674,2970,2971],{"class":684}," null",[674,2973,1388],{"class":705},[674,2975,1853],{"class":692},[674,2977,2132],{"class":688},[674,2979,1710],{"class":705},[674,2981,2983,2985,2987,2989,2991,2993,2995,2997,2999],{"class":676,"line":2982},43,[674,2984,2701],{"class":684},[674,2986,1665],{"class":705},[674,2988,2706],{"class":692},[674,2990,2709],{"class":705},[674,2992,2154],{"class":688},[674,2994,2714],{"class":705},[674,2996,1886],{"class":692},[674,2998,1889],{"class":684},[674,3000,2721],{"class":705},[674,3002,3004],{"class":676,"line":3003},44,[674,3005,2736],{"class":705},[674,3007,3009,3012,3015],{"class":676,"line":3008},45,[674,3010,3011],{"class":705},"        $page",[674,3013,3014],{"class":692},"++",[674,3016,1635],{"class":705},[674,3018,3020],{"class":676,"line":3019},46,[674,3021,1117],{"class":705},[674,3023,3025],{"class":676,"line":3024},47,[674,3026,1176],{"class":705},[674,3028,3030],{"class":676,"line":3029},48,[674,3031,1426],{"emptyLinePlaceholder":1425},[674,3033,3035],{"class":676,"line":3034},49,[674,3036,3037],{"class":1915},"\u002F\u002F Usage\n",[674,3039,3041,3044,3046,3049,3052,3054,3056,3059],{"class":676,"line":3040},50,[674,3042,3043],{"class":692},"foreach",[674,3045,1648],{"class":705},[674,3047,3048],{"class":1642},"everyRecord",[674,3050,3051],{"class":705},"($token, ",[674,3053,2221],{"class":688},[674,3055,1388],{"class":705},[674,3057,3058],{"class":692},"as",[674,3060,3061],{"class":705}," $student) {\n",[674,3063,3065,3068,3071,3074,3077,3080,3083,3086,3088,3091],{"class":676,"line":3064},51,[674,3066,3067],{"class":684},"    echo",[674,3069,3070],{"class":705}," $student[",[674,3072,3073],{"class":688},"'_id'",[674,3075,3076],{"class":705},"], ",[674,3078,3079],{"class":688},"' '",[674,3081,3082],{"class":705},", $student[",[674,3084,3085],{"class":688},"'username'",[674,3087,3076],{"class":705},[674,3089,3090],{"class":684},"PHP_EOL",[674,3092,1635],{"class":705},[674,3094,3096],{"class":676,"line":3095},52,[674,3097,1176],{"class":705},[370,3099,3101],{"id":3100},"when-the-data-changes-while-you-page","When the data changes while you page",[357,3103,3104,3105,3107],{},"Pages are counted from the start of the list each time you ask: page 3 with ",[361,3106,761],{}," means \"skip 200 records, then take 100\". The API keeps no cursor between your requests. If records are added or removed while you are paging, the rest of the list shifts:",[582,3109,3110,3120],{},[585,3111,3112,3115,3116,3119],{},[588,3113,3114],{},"A record removed"," from an earlier page moves every later record up by one. The first record of your next page was on the page you already read, so you ",[588,3117,3118],{},"skip"," one record.",[585,3121,3122,3125,3126,577],{},[588,3123,3124],{},"A record added"," to an earlier page moves every later record down by one. You ",[588,3127,3128],{},"see one record twice",[357,3130,3131],{},"How to cope:",[582,3133,3134,3142,3148,3154,3160],{},[585,3135,3136,3141],{},[588,3137,3138,3139,577],{},"Deduplicate by ",[361,3140,501],{}," Always, on every full walk.",[585,3143,3144,3147],{},[588,3145,3146],{},"Walk quickly."," The shorter the walk, the less can change during it. Fetch pages one after another, not spread over an hour.",[585,3149,3150,3153],{},[588,3151,3152],{},"Do not delete on absence."," If a record you hold did not appear in a walk, fetch it by id before you conclude it is gone. Paging may have skipped it.",[585,3155,3156,3159],{},[588,3157,3158],{},"Re-walk for completeness."," For a nightly sync, a second walk that finds nothing new is good evidence you have everything.",[585,3161,3162,3167,3168,3170],{},[588,3163,3164,3166],{},[361,3165,1215],{}," is a snapshot."," It was counted when the page was served, and the next page can have a different total. Do not stop just because you have collected ",[361,3169,1215],{}," records; stop on the page rules above.",[357,3172,3173,3174,3176],{},"The exam list changes by itself over time. ",[402,3175,490],{"href":217}," returns only exams still open for application, so an exam drops out as its sitting approaches or when applications close. That is also why its order (soonest sitting first) can move records forward between two walks.",[370,3178,3180],{"id":3179},"totals-count-only-what-you-can-see","Totals count only what you can see",[357,3182,3183,3185],{},[361,3184,1215],{}," counts the records you are allowed to see, never the whole platform:",[375,3187,3188,3198],{},[378,3189,3190],{},[381,3191,3192,3195],{},[384,3193,3194],{},"List",[384,3196,3197],{},"Counts",[394,3199,3200,3209,3218,3229,3247,3256],{},[381,3201,3202,3206],{},[399,3203,3204],{},[402,3205,448],{"href":171},[399,3207,3208],{},"Your own students",[381,3210,3211,3215],{},[399,3212,3213],{},[402,3214,462],{"href":196},[399,3216,3217],{},"Your own students who have access to that organization",[381,3219,3220,3226],{},[399,3221,3222,591,3224],{},[402,3223,508],{"href":235},[402,3225,522],{"href":241},[399,3227,3228],{},"Applications of your own students who have access to that organization and have signed in to it",[381,3230,3231,3237],{},[399,3232,3233,591,3235],{},[402,3234,550],{"href":264},[402,3236,564],{"href":270},[399,3238,3239,3240,3243,3244,3246],{},"That student's ",[588,3241,3242],{},"released"," documents only (see ",[402,3245,92],{"href":93},")",[381,3248,3249,3253],{},[399,3250,3251],{},[402,3252,404],{"href":150},[399,3254,3255],{},"Countries that can be selected; some cannot, and are left out",[381,3257,3258,3262],{},[399,3259,3260],{},[402,3261,490],{"href":217},[399,3263,3264],{},"Exams open for application now",[370,3266,3268],{"id":3267},"budgeting-pages-against-the-rate-limit","Budgeting pages against the rate limit",[357,3270,3271,3272,3274,3275,3277],{},"Each operation allows your account 100 requests per 60 seconds, counted on its own (see ",[402,3273,45],{"href":46},"). At ",[361,3276,761],{},", one list operation can therefore deliver up to 10,000 records a minute. Some typical numbers:",[375,3279,3280,3293],{},[378,3281,3282],{},[381,3283,3284,3287,3290],{},[384,3285,3286],{},"Task",[384,3288,3289],{},"Requests",[384,3291,3292],{},"Minimum time",[394,3294,3295,3308,3319,3333],{},[381,3296,3297,3300,3305],{},[399,3298,3299],{},"All 2,350 of your students",[399,3301,3302,3303],{},"24 pages of ",[361,3304,453],{},[399,3306,3307],{},"Well under a minute",[381,3309,3310,3313,3316],{},[399,3311,3312],{},"All applications on one organization, 8,000 rows",[399,3314,3315],{},"80 pages",[399,3317,3318],{},"Under a minute",[381,3320,3321,3324,3330],{},[399,3322,3323],{},"Certificates for 1,200 students on one organization",[399,3325,3326,3327,3329],{},"1,200 calls to ",[361,3328,550],{}," (one or more per student)",[399,3331,3332],{},"About 12 minutes",[381,3334,3335,3338,3341],{},[399,3336,3337],{},"The same for two organizations",[399,3339,3340],{},"2,400 calls to the same operation",[399,3342,3343],{},"About 24 minutes: one operation shares one budget across organizations",[357,3345,3346,3347,3349,3350,3352],{},"Per-student lists cost one request per student, whatever ",[361,3348,367],{}," is, so plan those jobs by the number of students, not by the number of records. A different operation, such as the certificate download, has its own budget and can run alongside. ",[402,3351,109],{"href":110}," builds a complete nightly job on these numbers.",[3354,3355,3356],"style",{},"html pre.shiki code .soyes, html code.shiki .soyes{--shiki-default:#702C00;--shiki-dark:#FFB757}html pre.shiki code .s-5SL, html code.shiki .s-5SL{--shiki-default:#023B95;--shiki-dark:#91CBFF}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 .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":670,"searchDepth":696,"depth":920,"links":3358},[3359,3360,3361,3362,3363,3364,3365],{"id":372,"depth":696,"text":373},{"id":604,"depth":696,"text":605},{"id":849,"depth":696,"text":850},{"id":1292,"depth":696,"text":1293},{"id":3100,"depth":696,"text":3101},{"id":3179,"depth":696,"text":3180},{"id":3267,"depth":696,"text":3268},"How list operations page their results. Covers page and limit, defaults and caps, the pagination object, ordering, and loops that safely fetch every page.","md",{},[404,419,434,448,462,476,490,508,522,536,550,564],"30",{"title":39,"description":3366},"api\u002Fpagination","P-CFeQNcV1i1dcZXKvFUTMQ5ZU_qn2IJVd4BIejD5hw",[3375,3380,3384,3388,3392,3396,3400,3404,3408,3411,3414,3418],{"operationId":404,"slug":3376,"method":133,"path":3377,"tag":74,"summary":149,"deprecated":134,"public":134,"permission":3378,"scope":3379,"order":933},"list-countries","\u002Fv1\u002Fcountry","country\u002Fread:$org:$ID","flat",{"operationId":419,"slug":3381,"method":133,"path":3382,"tag":74,"summary":155,"deprecated":134,"public":134,"permission":3383,"scope":3379,"order":948},"list-grades","\u002Fv1\u002Fgrade","grade\u002Fread:$org:$ID",{"operationId":434,"slug":3385,"method":133,"path":3386,"tag":74,"summary":161,"deprecated":134,"public":134,"permission":3387,"scope":3379,"order":974},"list-organizations","\u002Fv1\u002Forganization","organization\u002Fread:$org:$ID",{"operationId":448,"slug":3389,"method":133,"path":3390,"tag":62,"summary":170,"deprecated":134,"public":134,"permission":3391,"scope":3379,"order":1000},"list-students","\u002Fv1\u002Fstudent","student\u002Fread:$org:$ID",{"operationId":462,"slug":3393,"method":133,"path":3394,"tag":62,"summary":195,"deprecated":134,"public":134,"permission":3391,"scope":3395,"order":1114},"list-org-students","\u002Fv1\u002F{organizationId}\u002Fstudent","organization",{"operationId":476,"slug":3397,"method":133,"path":3398,"tag":83,"summary":219,"deprecated":134,"public":134,"permission":3399,"scope":3395,"order":2070},"list-exam-categories","\u002Fv1\u002F{organizationId}\u002Fexam-category","exam-category\u002Fread:$org:$ID",{"operationId":490,"slug":3401,"method":133,"path":3402,"tag":83,"summary":216,"deprecated":134,"public":134,"permission":3403,"scope":3395,"order":2053},"list-exams","\u002Fv1\u002F{organizationId}\u002Fexam","exam\u002Fread:$org:$ID",{"operationId":508,"slug":3405,"method":133,"path":3406,"tag":86,"summary":234,"deprecated":134,"public":134,"permission":3407,"scope":3395,"order":2137},"list-applications","\u002Fv1\u002F{organizationId}\u002Fapplication","application\u002Fread:$org:$ID",{"operationId":522,"slug":3409,"method":133,"path":3410,"tag":86,"summary":240,"deprecated":134,"public":134,"permission":3407,"scope":3395,"order":2176},"list-exam-applications","\u002Fv1\u002F{organizationId}\u002Fapplication\u002Fexam-applications\u002F{examId}",{"operationId":536,"slug":3412,"method":133,"path":3413,"tag":86,"summary":243,"deprecated":134,"public":134,"permission":3407,"scope":3395,"order":2182},"list-student-applications","\u002Fv1\u002F{organizationId}\u002Fapplication\u002Fstudent-applications\u002F{studentId}",{"operationId":550,"slug":3415,"method":133,"path":3416,"tag":256,"summary":263,"deprecated":134,"public":134,"permission":3417,"scope":3395,"order":2239},"list-student-certificates","\u002Fv1\u002F{organizationId}\u002Fcertificate\u002F{userId}","certificate\u002Fread:$org:$ID",{"operationId":564,"slug":3419,"method":133,"path":3420,"tag":256,"summary":269,"deprecated":134,"public":134,"permission":3421,"scope":3395,"order":2275},"list-student-reports","\u002Fv1\u002F{organizationId}\u002Freport\u002F{userId}","report\u002Fread:$org:$ID",1791554614927]