Discussions
IK12 API Wrapper - JavaScript Library
about 1 month ago by Nathan Ng
Hi everyone,
I created an open sourced library for integrating JS-based applications with Informed K12's API:
https://github.com/connectk12/ik12
It is registered with NPM: https://www.npmjs.com/package/@connectk12/ik12
And can be installed by running: npm install @connectk12/ik12
- I am actively maintaining it (and also welcoming any contributions via PR)
- Written 100% in TypeScript
- Uses
node-fetch
- MIT License
Currently (v0.0.6) it has the following functions:
getCampaignResponses
: Retrieves campaign responses by campaignId, with all available options in the query params table (https://developer.informedk12.com/reference/get_campaign-id-responses)getValueFromField
: Loops through all fields in the response to find a field by field numbergetValueFromFieldAsNumber
: Same asgetValueFromField
but parses it as a number (float)getArrayFromField
: Retrieves all fields with a field number array (useful if you want to retrieve a lot of input fields in one array)sanitizeText
: Sanitizes field values with different options available, which helps to match the field value to another value (e.g. trim, remove whitespace, remove special characters, uppercase). The helper functions above also contain options to sanitize when retrieving the value.
Not currently supported:
- Integration with Data Source API (coming soon!)
- Integration with User Management API (not yet planned)
Hope this helps others in the Informed K12 ecosystem! Please let me know if you are using it - would love to hear about your use cases and what else I can add to this library.
If you have any questions about using this library (or about connecting to Informed K12's APIs in general), I can answer questions here in the discussion, or you can reach me at [email protected]