Knewton API Client (Grifter/ruby based)
Intro
Expressively interact with any Knewton HTTP+JSON API(s) using:
- command line calls
- scripts of abritrary complexity
- quantum magic
Helps manages the complexity of:
- specifying which environment you are interacting with (QA, Superman, UAT, etc)
- authentication / controlling who you are while making api calls
- access to reference data like graph IDs
- self actualization
Our official API documentation (http://dev.knewton.com/reference/) is a nice reference to have open when learning this tool.
Setup
Examples
Authenticate as a 'knerd' (super user)
This command returns an Authorization token for a 'knerd' user.
This token can be used in REST client browser plugins for manually calling the API.
To do this, just set the output to the Authorization header in the REST client plugin.
$ grift -q -n -e Superman knerd_token
Run a grift script that gets a recommendation for a brand new student and goal
Checked in is an example script showing all the steps needed to get a recommendation.
$ grift -v -n -e QA -f examples/get_a_recommendation.rb
Get a recommendation for a known registration and goal id
The above script created a brand new test registraiton and test goal.
If you already have a registration and goal, perhaps given by a partner,
you can see the current recommendation for it by calling get_recommendation
grift straight off the command line.
An easy way to demo this is to run the above example, and get the registration
and goal id from the log that is produced.
$ grift -e QA get_recommendation <reg id> <goal id>
See all the available grift methods
This will list all the methods that define the DSL for interacting with the API.
$ grift --list
More reading
To understand how grifter works, check out it's github: https://github.com/Knewton/grifter