Commands for the API

This is a list of all publicly accessible commands from the Schooltraq API. If something isn’t working right, please let us know.

We’ve sorted this list by getcreateupdate, and delete, and then further alphabetically.

get assignment

Returns information about a single assignment.

Provide:
assignmentid: The ID of the assignment.
Authentication.

get assignmentlist

Returns a list of the user’s assignments, along with detailed information on each assignment.

If there are no assignments, this command will return an error code of noassignments. In the near future, it will return a successful status but provide an empty list of assignments.

This command returns JSON sorted as is on the Dashboard: by status, then by due date, then by importance. Many JSON processors, however, will resort responses by their key, which defaults to the assignment ID. Notably, this occurs often with jQuery. To avoid this, use the keyas key to change this command to return keys as an iterator beginning from 1 (not zero).

This command is limited to 500 assignments.

Provide:
archived: (Optional) Either provide active or archived — an active assignment is one that is either open or completed (the Dashboard view). Defaults to active.
keyas: (Optional) Either provide id or iterator — the assignment list will be keyed as provided. Defaults to id.
Authentication.

get courselist

Returns a list of the user’s classes, along with information on the classes.

If there are no courses, this command returns a success status but provides an empty list of courses.

Provide:
Authentication.

get status

Returns “online” if the Schooltraq API is available to use.

Provide:
No authentication.

get userinfo

This command returns information about a user, including their username, email address, API key, account expiration date, and various user preferences as they become available. It’s helpful for determining a user’s API key from a username and password as well.

Note: If the user has not yet generated an API key, the apikey will return 0 (a zero).

Provide:
Either authentication (API key), or
username: The username of the user.
password: The password of the user.

get validkey

Checks if a key is formatted correctly and still active in the Schooltraq system.

Note: If the key is formatted correctly, the API will return a “response” of “success” regardless of whether or not the key is active. The “apikey” will return either “correct” or “incorrect” based on whether or not the key is still active.

Provide:
Authentication.

create assignment

Adds a new and uncompleted assignment to Schooltraq. The API will return the newly added assignment, including its ID and contents, under key assignment.

Provide:
Authentication.
asnname: The assignment name
asndue: The due date, in format YYYY-MM-DD
asnimportance: Provide “true” or “false” (as text!) depending on whether or not the assignment is important.
asnnotes: Assignment notes (not required)
asnclass: The class ID of the class that this assignment belongs to.

create course

Creates a new class. The API will return the newly added course, including its ID and contents, under key course. For backwards compatibility, it also returns the newly added course as the value of its ID, but this has been deprecated; please use key course instead.

Provide:
Authentication.
classname: The name of the class, not to exceed 50 characters.
classalias: The alias of the class, not to exceed 18 characters.
classcolor: The color of the class, in six-digit hexidecimal form.

create newkey

Creates a new API key for the user and returns it, along with the previous key (if any).

Note: Before running this command, you should always run “GET USERINFO” to check if the user already has an API key. If an API key already exists, you must provide a confirmation. You are not allowed to run this command unless the user has specifically requested it. You should provide a confirmation for this command.

Second note: It is intentionally impossible to create a new API key from an API request – you must have the username and password.

Provide:
No authentication.
username: The username of the user.
password: The password of the user.

update assignment

Lets you update and change anything about an assignment, except for deleting an assignment or changing its status.

Important: You must re-supply any data that you do not want changed back to the API. Sending a field as null will cause an error to be returned or will null that field.

Provide:
Authentication.
assignmentid: The ID of the assignment.
asnname: The name of the assignment. asndue: The due date of the assignment. asnimportance: (optional) The priority/importance of the assignment; supply anything to return as important and leave blank to mark not important. asnnotes: (optional) Any notes for the assignment. asnclass: The ID of the associated class.

update assignmentstatus

Lets you change the status of an assignment, to open, complete, or archived.

Provide:
Authentication.
assignmentid: The ID of the assignment.
asnstatus: The new status of this assignment, “open”, “complete”, or “archived”.

update course

Lets you update a course and change anything about a course.

Provide:
Authentication.
classid: The ID of the class.
classname: (optional) The name of the class, not to exceed 50 characters.
classalias: (optional) The alias of the class, not to exceed 18 characters.
classcolor: (optional) The color of the class, in six-digit hexidecimal form.

delete assignment

Deletes an assignment.

Provide:
Authentication.
assignmentid: The ID of the assignment.

delete course

Delete a course.

Note: You should check for any assignments in this course before you run this command, and if there are assignments still associated, display a warning message.

Provide:
Authentication.
classid: The ID of the class.