- For: anyone who writes a little JavaScript
- You get: a Node.js script that saves the waiting list to a CSV file
- Time: about five minutes
- Scopes:
waiting-list:read
waiting-list.csv. It needs Node.js 18 or later, which has fetch built in. There is nothing to install.
waiting-list.mjs
Look up one member
To read one member, ask for them byid. It returns the same fields as the list. A member of another group, or an id that does not exist, answers 404 not_found. This uses get() from the script above, so paste it below that script, or into a file with a copy of BASE, API_KEY and get().
lookup-member.mjs
members:read scope for this part.
Write data
The sandbox key is read only. A write needs your own key, with a write scope, onapi.scoutworks.app. Try each write on a test record first, then check it in Scoutworks and undo it there. See Try a write safely.
This script adds a draft event, then moves it an hour later only if nobody has changed it since. A draft is safe to try: families hear of an event only when a leader publishes it in Scoutworks, and you can delete it there. The key needs events:read and events:write.
add-draft-event.mjs
Switch to your group
Changeapi-demo.scoutworks.app to api.scoutworks.app, and set your key in the environment instead of the code. read -s asks for the key without showing it, so it stays out of your shell history:
waiting-list:read scope.
TypeScript
The OpenAPI file describes every response. Generate types from it with openapi-typescript:Notes
- Only in a server or a script. Do not call the API from a web page that other people open. The key would be in the page, and anyone could read it.
- Fields that may be missing. A field that the key’s scopes do not allow is left out. Use
w.parent?.email, notw.parent.email, for the.contactsfields. - Other lists. Change
/waiting-listand the filters. The API reference lists every endpoint and field.