schoology
v0.1.5
Published
Format requests to the Schoology API
Downloads
311
Readme
schoology
Format requests to the Schoology API
Installation
npm i schoology -S
Usage
To consume the Schoology API, you'll need an API key and secret. Find these by logging in to schoology and navigating to /api
(typically https://app.schoology.com/api or https://[your district].schoology.com/api)
Instantiate the client like this:
import SchoologyAPI from 'schooology' const client = new SchoologyAPI(key, secret, site_base?, api_host?)
key
andsecret
are required. If you log in to a unique district website eg. https://district123.schoology.com then send that as the third argument.You probably don't need to send
api_host
but it can be overridden as the fourth argument here.Obtain a request token
await client.getRequestToken()
The SchoologyAPI instance stores the response token for subsequent requests.
Complete Oauth flow
This means redirecting the user to login at their schoology site where they will be prompted to approve access to their schoology account. Use SchoologyAPI to generate the correct redirect URL like this:
const url = client.getConnectURL(return_url)
After the user approves access, the schoology site will redirect the user back to
return_url
.Exchange the authorized request token for an access token.
await client.getAccessToken()
The SchoologyAPI instance stores the response token for subsequent requests.
Make requests!
const userInfo = await client.makeRequest('get', '/app-user-info')