- For: anyone writing a recipe for these docs
- You get: a template to copy, and the rules every recipe follows
- Time: read it once, about five minutes
- Scopes: none
The template
Copy this intoapps/developers/recipes/<name>.mdx, then add the page to docs.json under its role, and to Recipes by tool.
The header
Every recipe opens with the same four lines, so a volunteer can tell in five seconds whether it is for them:- For: a role, never “developers”. Leaders, treasurers, group admins and trustees, or districts.
- You get: the finished thing, not the steps. “A Budgets tab”, not “a script that reads budgets”.
- Time: honest, for someone doing it for the first time.
- Scopes: every scope the recipe needs, so the admin creating the key gets it right first time.
Style
- Plain UK English. Short sentences. One idea in each. “Choose”, not “click”; “sign in”, not “log in”.
- Sentence-case headings. “Switch to your group”, not “Switch To Your Group”.
- Numbered steps for anything done in order. Use
<Steps>when each step needs a sentence of its own. - Name what is on screen in bold, exactly as the app or the tool spells it: Settings → Integrations → API keys.
- Say why when a step is not obvious, in one sentence after it.
- No jargon a volunteer would not use. Explain a term the first time, or leave it out.
Rules every recipe keeps
- It works as written with the sandbox key. Every request uses
api-demo.scoutworks.appand the public sandbox key, so a reader can paste it and see real-looking results. Our tests run every request a page spells out, and fail if one stops working. - It never shows a real key. The only key on any page is the sandbox key. Tell readers where to keep their own: Script Properties, a credential store, an environment variable.
- It reads every page of a list. Follow
nextCursorto the end, and waitretryAfterseconds on a429. CopyreadAll()andfetchScoutworks()from an existing recipe rather than writing new ones. - It treats money as text. The API sends
"12.50", never a number, so pennies are never lost. Convert only to show it. - It keeps names out of formulas. Anything written into a spreadsheet passes through
safe(), so a name that starts with=stays text. - It warns about personal data. If the result holds names, contact details or who owes money, say who it is safe to share with.
- It names the scopes it needs, including the
.peopleor.contactsscope a column needs, and what happens without it.
Recipes that change data
A recipe that writes, such as Bank statement into the books, also:- says at the top that the read-only sandbox key cannot run it, so the reader needs their own key with the write scope;
- has a step that tries it on one made-up item, checks the result in Scoutworks, and deletes or undoes it before the real run;
- sends an
Idempotency-Keywith everyPOST, made from the thing being added, so a retry never adds it twice; - sends the
If-MatchorupdatedAtit read with every change, and tells the reader what a412 stale_writemeans (Writing data has the rules); - waits between writes, to stay under 30 changes a minute;
- writes back what it did, such as the new id, so a second run skips what is already done.