Skip to content
API documentation

Changelog

Version 1.7.0

7 changes: 3 added, 3 changed, 1 removed.

Added

  • Wallet. Main Team can now give your account credits for each olympiad, and you spend them to pay applications. A credit is a convenience: an application paid with it is marked paid at once, and the amount for it is still due to Main Team and settled afterwards by bank transfer. The wallet is not self-service: Main Team opens it only after an agreement and on your request (ask your Main Team contact or info@main-team.org), and bank transfer stays the default way to pay. One credit pays one application that has a price; a free exam never takes one. getWallet (GET /v1/wallet) and listWalletEntries (GET /v1/wallet/entries), under the new permission wallet/read on mto, read your balance (granted, spent and remaining for each olympiad, what the spent credits paid in cents and their currency, USD for neo and EUR for the others) and the history of every credit added and spent, with filters. payApplicationFromWallet (POST /v1/{organizationId}/application/{applicationId}/wallet-pay) and payApplicationsFromWallet (POST /v1/{organizationId}/application/wallet-pay, 1 to 100 applications, all or nothing, one reference and one invoice number, 30 requests a minute) pay applications that exist already, under the new permission application/pay. createApplication takes an optional walletPay and answers data.wallet; a repeat call with walletPay: true pays a payment that is still pending. The application, its payment and the debit are written together or not at all. Without a wallet, nothing changes: every wallet operation and walletPay: true answer 403 with error.details.reason wallet_not_enabled. New reasons under existing error codes: forbidden (wallet_not_enabled, permission_missing), conflict (insufficient_credits, with error.details.organizations, already_paid, payment_canceled, payment_in_progress, payment_changed) and service_unavailable (wallet_unavailable). A role of application/*, */* or * grants application/pay, and */read, */* or * grants wallet/read; spending still needs a wallet Main Team has enabled. Reversals are Main Team's, never the API's.
  • Entering a student for exams while registering them. registerStudent and each row of createStudentImport take an optional exams: up to 10 entries of { organizationId, examId } (an import: 2000 in the whole batch), checked by the rules createApplication applies. The student, their registration on each olympiad named, the applications and their payments are saved together or not at all. registerStudent and createStudentImport also take an optional walletPay: every priced exam is paid from your wallet, one credit each, in that same write, so a wallet that cannot cover the exams creates nothing, not even the student. walletPay: true always needs an enabled wallet (403 wallet_not_enabled otherwise, even when every exam is free) and application/create and application/pay on every organization named (403 permission_missing, listing what is missing). registerStudent answers data.applications (and data.wallet); checkStudentRegistration takes exams and walletPay and answers data.exams (price, currency, free, credits, or the problem) and data.wallet (enabled, needed, available, sufficient), and writes nothing. For an import, getStudentImport adds walletPay, creditsNeeded and, on each registered row, applications. The credit check when an import is submitted is advisory (409 insufficient_credits, every organization the batch needs); the credits are taken when it runs. Closed sets gain values: a row code can be exam_not_offered or exam_conflict, and an import failure.code can be insufficient_credits or wallet_not_enabled, with failure.details.organizations. These values are reachable only by requests that send exams or walletPay, so no working call changes; a client that switches over these sets exhaustively needs the new cases. A batch sent again with walletPay is not mistaken for the same batch sent without it. Without exams and walletPay both operations behave exactly as before.
  • checkStudentRegistration answers data.willCreate, { city, school }: true for a city or school name that is not in our list yet and would be added when you register (see Changed). The check still writes nothing. Additive: ignore the field if you do not need it.

Changed

  • createApplication no longer answers 409 (Student has never signed in to …) for a student you registered here who has not signed in to that organization yet: it creates the student's record in the organization first, the one the student's first sign-in finds and updates, and then the application. It still answers that 409 when the organization already has an account with the student's email address, or Main Team has already assigned exams to the student; the first sign-in settles those. The other operations that need the organization's record are unchanged.
  • createApplication and moveApplication price a coding application by the CodeCombat and Codementum bundle rule the website already uses: once the student has paid one of those exams this season, another exam of the same category costs 15 and one of the other category 30 (15 once one of that category is paid too), never more than the exam's own price. Before, the payment was always the exam's own price. The exam lists still show the exam's price; the payment shows what is due. A paid application moves between the two categories at the price it was paid at. Other organizations and categories are unchanged.
  • If a school or city name is not in our list yet, registerStudent, createStudentImport, updateStudent and updateOrgStudent now add it automatically. Before, such a name was refused with 400 bad_request (… is not a known school. This API does not create reference data.). checkStudentRegistration shows beforehand which names would be added (willCreate), so you can fix a typo first. A new name may be at most 120 characters for a school and 80 for a city, without < or >; a name that breaks this is still refused (400, row code unknown_reference in an import). A country or grade that matches nothing, and an _id that matches nothing, are refused as before. Not a breaking change: only calls that failed before now succeed.

Removed

Search the API documentation

Guides, endpoints by name, path or permission, and error codes such as not_found.