Constructor
new PowerSchoolAPI(url, apiUsernameopt, apiPasswordopt)
Create an API wrapper.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
url |
string | The main URL of the PowerSchool installation, such as "http://sales.powerschool.com". | ||
apiUsername |
string |
<optional> |
pearson | The API username to use for logging in, if your installation has a different one. For most installations, the default provided value should work. |
apiPassword |
string |
<optional> |
m0bApP5 | The API password to use for logging in, if your installation has a different one. For most installations, the default provided value should work. |
Methods
login(username, password) → {Promise.<PowerSchoolUser, Error>}
Log into a user's account and get their user object.
Parameters:
Name | Type | Description |
---|---|---|
username |
string | The username of the account to log in to. |
password |
string | The password of the account to log in to. |
Returns:
- A promise that resolves with the user if login was successful, resolves to null if invalid credentials were provided, and rejects with an Error if another error occurred during login.
- Type
- Promise.<PowerSchoolUser, Error>
setup() → {Promise.<PowerSchoolAPI, Error>}
Setup the API wrapper for usage (required for any interaction).
Returns:
- A promise that returns the API again if resolved, or an Error if rejected.
- Type
- Promise.<PowerSchoolAPI, Error>