Add Oauth2 Identity
POST
/
users
/
:handle
/
o-auth-identities

Adds an OAuth2 identity to the user, so that they can be logged in with that identity. You need to send the OAuth code or the access token to this endpoint. 1. If no access token is provided, it will use your OAuth2 token URL to exchange the given code for an access token. 2. Then it will use the access token (given by you, or received from step 1) to look up the user on your service using the lookup URL, and expects a JSON object in response with an id property. 3. It will then save that user id to the user in our db as a new OAuthIdentity. In this example, we call your lookup URL (let's say, https://oauth.provider/user?t=<%= accessToken %>) with the access token (1234). The lookup URL returns { id: 'abcd' } in this case, which we save to the user in our db.

Path parameters
handle
string

The document's _id or slug.

Request
This endpoint expects an object.
provider
string

Your OAuth Provider ID.

accessToken
optional string

Will be passed through your lookup URL to get the user ID. Required if no code.

code
optional string

Will be passed to the OAuth token endpoint to get a token. Required if no accessToken.

Response
This endpoint returns an object.
_id
optional string
email
optional string
name
optional string
slug
optional string
role
optional string
stats
optional object
Show 3 properties
oAuthIdentities
optional list of objects
Show 2 properties
subscription
optional object
Show 2 properties
license
optional object
Show 2 properties
Auth
Login User
GET
/
auth
/
login-o-auth

Logs a user in. In this example, we call your lookup URL (let's say, https://oauth.provider/user?t=<%= accessToken %>) with the access token (1234). The lookup URL returns { id: 'abcd' } in this case. We will match this id with the OAuthIdentity stored in the user information in our db. If everything checks out, the user is logged in and redirected to the home page.

Query parameters
provider
string

Your OAuth Provider ID

accessToken
optional string

Will be passed through your lookup URL to get the user ID. Required if no code.

code
optional string

Will be passed to the OAuth token endpoint to get a token. Required if no accessToken.

redirect
optional string

Override where the user will navigate to after successfully logging in.

errorRedirect
optional string

If an error happens, redirects the user to this url, with at least query parameters code, errorName and message.

Clans
Upsert User Into Clan
PUT
/
clan
/
:handle
/
members

Upserts a user into the clan.

Path parameters
handle
string

The document's _id or slug.

Request
This endpoint expects an object.
userId
string

The _id or slug of the user to add to the clan.

Response
This endpoint returns an object.
_id
optional string
name
optional string
displayName
optional string
members
optional list of strings
ownerID
optional string
description
optional string
type
optional string
kind
optional string
metadata
optional map from strings to any
Classrooms
Get Classroom Details
GET
/
classrooms

Returns the classroom details for a class code.

Query parameters
code
string

The classroom's code.

retMemberLimit
optional double

limit the return number of members for the classroom

Response
This endpoint returns an object.
_id
optional string
name
optional string
members
optional list of strings
ownerID
optional string
description
optional string
code
optional string
codeCamel
optional string
courses
optional list of objects
Show 4 properties
clanId
optional string
Classrooms
Create a classroom
POST
/
classrooms

Creates a new empty Classroom.

Request
This endpoint expects an object.
name
string

Name of the classroom

ownerID
string
aceConfig
object
Show property
Response
This endpoint returns an object.
_id
optional string
name
optional string
members
optional list of strings
ownerID
optional string
description
optional string
code
optional string
codeCamel
optional string
courses
optional list of objects
Show 4 properties
clanId
optional string
Classrooms
Upsert a user from classroom
PUT
/
classrooms
/
:handle
/
members

Upserts a user into the classroom.

Path parameters
handle
string

The document's _id or slug.

Request
This endpoint expects an object.
code
string

The code for joining this classroom

userId
string

The _id or slug of the user to add to the class.

retMemberLimit
optional double

limit the return number of members for the classroom, the default value is 1000

Response
This endpoint returns an object.
_id
optional string
name
optional string
members
optional list of strings
ownerID
optional string
description
optional string
courses
optional list of objects
Show 4 properties
Classrooms
Delete User from Classroom
DELETE
/
classrooms
/
:handle
/
members

Remove a user from the classroom.

Path parameters
handle
string

The document's _id or slug.

Request
This endpoint expects an object.
userId
string

The _id or slug of the user to remove from the class.

retMemberLimit
optional double

limit the return number of members for the classroom, the default value is 1000

Response
This endpoint returns an object.
_id
optional string
name
optional string
members
optional list of strings
ownerID
optional string
description
optional string
courses
optional list of objects
Show 4 properties
Classrooms
Enroll User in a Course
PUT
/
classrooms
/
:classroomHandle
/
courses
/
:courseHandle
/
enrolled

Enrolls a user in a course in a classroom. If the course is paid, user must have an active license. User must be a member of the classroom.

Path parameters
classroomHandle
string

The classroom's _id.

courseHandle
string

The course's _id.

Query parameters
retMemberLimit
optional double

limit the return number of members for the classroom, the default value is 1000

Request
This endpoint expects an object.
userId
string
Response
This endpoint returns an object.
_id
optional string
name
optional string
members
optional list of strings
ownerID
optional string
description
optional string
courses
optional list of objects
Show 4 properties
Classrooms
Remove User from a classroom
PUT
/
classrooms
/
:classroomHandle
/
courses
/
:courseHandle
/
remove-enrolled

Removes an enrolled user from a course in a classroom.

Path parameters
classroomHandle
string

The classroom's _id.

courseHandle
string

The course's _id.

Query parameters
retMemberLimit
optional double

limit the return number of members for the classroom, the default value is 1000

Request
This endpoint expects an object.
userId
string
Response
This endpoint returns an object.
_id
optional string
name
optional string
members
optional list of strings
ownerID
optional string
description
optional string
courses
optional list of objects
Show 4 properties
Classrooms
Get Member Stats
GET
/
classrooms
/
:classroomHandle
/
stats

Returns a list of all members stats for the classroom.

Path parameters
classroomHandle
string

The classroom's _id.

Query parameters
project
optional string

If specified, include only the specified projection of returned stats; else, return all stats. Format as a comma-separated list, like creator,playtime,state.complete.

memberLimit
optional double

Limit the return member number. the default value is 10, and the max value is 100

memberSkip
optional double

Skip the members that doesn't need to return, for pagination

Response
This endpoint returns a list of objects.
_id
optional string
stats
optional object
Show 2 properties
Classrooms
Get Level Session
GET
/
classrooms
/
:classroomHandle
/
members
/
:memberHandle
/
sessions

Returns a list of all levels played by the user for the classroom.

Path parameters
classroomHandle
string

The classroom's _id.

memberHandle
string

The classroom member's _id.

Response
This endpoint returns a list of objects.
state
optional object
Show property
level
optional object
Show property
levelID
optional string

Level slug like wakka-maul

creator
optional string
playtime
optional integer

Time played in seconds.

changed
optional string
created
optional string
dateFirstCompleted
optional string
submitted
optional boolean

For arenas. Whether or not the level has been added to the ladder.

published
optional boolean

For shareable projects. Whether or not the project has been shared with classmates.

Stats
Get Playtime Stats
GET
/
playtime-stats

Returns the playtime stats

Query parameters
startDate
optional string

Earliest an included user was created

endDate
optional string

Latest an included user was created

country
optional string

Filter by country string

Response
This endpoint returns an object.
playTime
optional double

Total play time in seconds

gamesPlayed
optional double

Number of levels played

Stats
Get License Stats
GET
/
license-stats

Returns the license stats

Response
This endpoint returns an object.
licenseDaysGranted
optional double

Total number of license days granted

licenseDaysUsed
optional double

Number of license days used

licenseDaysRemaining
optional double

Number of license days remaining

activeLicenses
optional double

Number of active/valid licenses

Users
Create User
POST
/
users

Creates a User.

Request
This endpoint expects an object.
name
string
email
string
role
optional enum

"student" or "teacher". If unset, a home user will be created, unable to join classrooms.

Show 2 enum values
preferredLanguage
optional string
heroConfig
optional object
Show property
birthday
optional string
Response
This endpoint returns an object.
_id
optional string
email
optional string
name
optional string
slug
optional string
role
optional string
stats
optional object
Show 3 properties
oAuthIdentities
optional list of objects
Show 2 properties
subscription
optional object
Show 2 properties
license
optional object
Show 2 properties
Users
Get User
GET
/
users
/
:handle

Returns a User.

Path parameters
handle
string

The document's _id or slug.

Query parameters
includePlayTime
optional string

Set to non-empty string to include stats.playTime in response

Response
This endpoint returns an object.
_id
optional string
email
optional string
name
optional string
slug
optional string
role
optional string
stats
optional object
Show 3 properties
oAuthIdentities
optional list of objects
Show 2 properties
subscription
optional object
Show 2 properties
license
optional object
Show 2 properties
Users
Update User
PUT
/
users
/
:handle

Modify name of a User

Path parameters
handle
string

The document's _id or slug.

Request
This endpoint expects an object.
name
string

Set to new name string

birthday
optional string

Set the birthday

Response
This endpoint returns an object.
_id
optional string
email
optional string
name
optional string
slug
optional string
role
optional string
stats
optional object
Show 3 properties
oAuthIdentities
optional list of objects
Show 2 properties
subscription
optional object
Show 2 properties
license
optional object
Show 2 properties
Users
Get Classrooms By User
GET
/
users
/
:handle
/
classrooms

Returns a list of Classrooms this user is in (if a student) or owns (if a teacher).

Path parameters
handle
string

The document's _id or slug.

Query parameters
retMemberLimit
optional double

limit the return number of members for each classroom

Response
This endpoint returns a list of objects.
_id
optional string
name
optional string
members
optional list of strings
ownerID
optional string
description
optional string
code
optional string
codeCamel
optional string
courses
optional list of objects
Show 4 properties
clanId
optional string
Users
Get User Hero
PUT
/
users
/
:handle
/
hero-config

Set the user's hero.

Path parameters
handle
string

The document's _id or slug.

Request
This endpoint expects an object.
thangType
optional string
Response
This endpoint returns an object.
_id
optional string
email
optional string
name
optional string
slug
optional string
role
optional string
stats
optional object
Show 3 properties
oAuthIdentities
optional list of objects
Show 2 properties
subscription
optional object
Show 2 properties
license
optional object
Show 2 properties
Users
Put Ace Config
PUT
/
users
/
:handle
/
ace-config

Set the user's aceConfig (the settings for the in-game Ace code editor), such as whether to enable autocomplete.

Path parameters
handle
string

The document's _id or slug.

Request
This endpoint expects an object.
liveCompletion
optional boolean

controls whether autocompletion snippets show up, the default value is true

behaviors
optional boolean

controls whether things like automatic parenthesis and quote completion happens, the default value is false

language
optional string

only for home users, should be one of ["python", "javascript", "cpp", "lua", "coffeescript"] right now

Response
This endpoint returns an object.
_id
optional string
email
optional string
name
optional string
slug
optional string
role
optional string
stats
optional object
Show 3 properties
oAuthIdentities
optional list of objects
Show 2 properties
subscription
optional object
Show 2 properties
license
optional object
Show 2 properties
Users
Put Subscription
PUT
/
users
/
:handle
/
subscription

Grants a user premium access to the "Home" version up to a certain time.

Path parameters
handle
string

The document's _id or slug.

Request
This endpoint expects an object.
ends
string
Response
This endpoint returns an object.
_id
optional string
email
optional string
name
optional string
slug
optional string
role
optional string
stats
optional object
Show 3 properties
oAuthIdentities
optional list of objects
Show 2 properties
subscription
optional object
Show 2 properties
license
optional object
Show 2 properties
Users
Shorten User Subscription
PUT
/
users
/
:handle
/
shorten-subscription

If the user already has a premium access up to a certain time, this shortens/revokes his/her premium access. If the ends is less than or equal to the current time, it revokes the subscription and sets the end date to be the current time, else it just shortens the subscription.

Path parameters
handle
string

The document's _id or slug.

Request
This endpoint expects an object.
ends
string
Response
This endpoint returns an object.
_id
optional string
email
optional string
name
optional string
slug
optional string
role
optional string
stats
optional object
Show 3 properties
oAuthIdentities
optional list of objects
Show 2 properties
subscription
optional object
Show 2 properties
license
optional object
Show 2 properties
Users
Grant User License
PUT
/
users
/
:handle
/
license

Grants a user access to the "Classroom" version up to a certain time. Sets their role to "student".

Path parameters
handle
string

The document's _id or slug.

Request
This endpoint expects an object.
ends
string
Response
This endpoint returns an object.
_id
optional string
email
optional string
name
optional string
slug
optional string
role
optional string
stats
optional object
Show 3 properties
oAuthIdentities
optional list of objects
Show 2 properties
subscription
optional object
Show 2 properties
license
optional object
Show 2 properties
Users
Shorten User License
PUT
/
users
/
:handle
/
shorten-license

If the user already has access to the "Classroom" version up to a certain time, this shortens/revokes his/her access. If the ends is less than or equal to the current time, it revokes the enrollment and sets the end date to be the current time, else it just shortens the enrollment.

Path parameters
handle
string

The document's _id or slug.

Request
This endpoint expects an object.
ends
string
Response
This endpoint returns an object.
_id
optional string
email
optional string
name
optional string
slug
optional string
role
optional string
stats
optional object
Show 3 properties
oAuthIdentities
optional list of objects
Show 2 properties
subscription
optional object
Show 2 properties
license
optional object
Show 2 properties
Users
Search for User
GET
/
user-lookup
/
:property
/
:value

Redirects to /users/{handle} given a unique, identifying property

Path parameters
property
string

The property to lookup by. May either be "israel-id" or "name".

value
string

The value to be looked up.