Skip to content

API: Users endpoints

/user

GET /user

Get/check user.

[] Input:

  • [!] string user: user identification string

[] Output:

  • string user: user identification string
  • string name: full name
  • boolean status: user is enabled
  • boolean exam: exam account

POST /user

Create new user account.

[] Input:

  • [!] string{4,64} username: username
  • string{4,64} password: password
    • default: initial random password is automatically generated
  • [!] string{1,64} first_name: first name
  • [!] string{1,64} last_name: last name
  • string{1,255} full_name: override automatic full name (built from first and last names)
  • string{1,255} display_name: override automatic display name (which is the full name)
  • [!] string email: valid email address
  • string phone: valid phone number
    • format: "+prefix number" without any special characters and symbols
    • example: +1 1234567890 or +36 301234567
  • string gender: gender
    • male
    • female
    • other
  • date birthdate: date of birth
  • boolean exam: user is only allowed to login when accessing exams
    • default: false
  • string group: name of the user group (requires admin permissions)
  • string template: a template ID for the new account
    • streaming: restricted users for automatically generated users for occasional streams
    • default: none
  • string custom_{field}: custom field data
    • only if specified field is configured for target EduBase instance
  • string language: desired account language
    • default: API application owner's language
  • string timezone: desired timezone
    • default: API application owner's timezone
  • string color: desired favorite color
    • possible values: default / branding / red / blue / yellow / green / purple
    • default: default
  • boolean must_change_password: user is forced to change password on first login
    • default: false
  • boolean notify: notify user via email (or SMS)
    • default: false

[] Output:

  • string user: user identification string
  • string username: username, only if exam=false
  • string password: password, only if exam=false

[] Example:

/* Initialize cURL */
$ch=curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);

/* Add data (as array) */
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_SAFE_UPLOAD, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

/* Process call and receive response */
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response=curl_exec($ch);
# Send data as multipart/form-data
curl -s --request POST --url "https://$API_DOMAIN/api/v$API_VERSION/user" --header "Content-Type: application/x-www-form-urlencoded" --data "username=$username" --data "first_name=$first_name" --data "last_name=$last_name" --data "full_name=$full_name" --data "email=$email" --data "exam=false" --data "template=$template" --data "app=$APP_ID" --data "secret=$APP_SECRET"

DELETE /user

Delete user.

[] Input:

  • [!] string user: user identification string

/user:name

GET /user:name

Get user's name.

[] Input:

  • [!] string user: user identification string

[] Output:

  • string user: the user identification string
  • string first_name: first name
  • string last_name: last name
  • string full_name: full name
  • string display_name: display name

POST /user:name

Update a user's name.

[] Input:

  • [!] string user: user identification string
  • [!] string{1,64} first_name: first name
  • [!] string{1,64} last_name: last name
  • string{1,255} full_name: full name
  • string{1,255} display_name: display name

[] Output:

  • string user: the user identification string
  • boolean success: operation is successful
  • boolean changed: name has been changed

/user:group

GET /user:group

Get user's group.

[] Input:

  • [!] string user: user identification string

[] Output:

  • string user: the user identification string
  • string group: user group code

POST /user:group

Update a user's group.

[] Input:

  • [!] string user: user identification string
  • [!] string group: user group code

[] Output:

  • string user: the user identification string
  • boolean success: operation is successful
  • boolean changed: name has been changed

/user:login

GET /user:login

Get latest valid login link for user.

[] Input:

  • [!] string user: user identification string

[] Output:

  • string user: the user identification string
  • string url: the login link
  • datetime valid: validity (end of day) of the generated link

POST /user:login

Generate link. If a valid link with the same settings exist, it will be returned instead of creating a new one.

[] Input:

  • [!] string user: user identification string
  • string redirect: redirect after a successful login
    • URI path or [{content_type}:{tag}]
  • integer/date expires: expiry in days (1-30) or YYYY-MM-DD
    • default: 1 day
  • integer logins: total count the link can be used to login users
    • default: 1
  • string template: a template ID for the login link
  • boolean short: generate shortened (eduba.se) link
    • only if feature is enabled on EduBase

[] Output:

  • string user: the user identification string
  • string url: the login link
  • datetime valid: validity of the generated link
  • integer count: maximum number the link can be used to login

DELETE /user:login

Delete a previously generated link.

[] Input:

  • [!] string user: user identification string
  • [!] string url: generated login link to be invalidated

/user:search

GET /user:search

Lookup user by email, username or code.

[] Input:

  • [!] string query: query string

[] Output:

  • string user: user identification string
  • boolean exam: exam account

/user:assume

POST /user:assume

Assume user for next requests with assume token.

[] Input:

  • [!] string user: user identification string, username or email address
  • string password: password or user secret

[] Output:

  • string user: user identification string
  • boolean token: assume token
  • datetime valid: validity of the generated token

DELETE /user:assume

Revoke assume token.

[] Input:

  • [!] string token: assume token