API: Users endpoints¶
/user¶
GET¶
Info
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¶
Info
Create new user account.
Input:
- [!] string{4,64} username: username
- [!] 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 email: valid email address
- 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 language: desired account language
- default: API application owner's language
- string timezone: desired timezone
- default: API application owner's timezone
Output:
- string user: user identification string
- string password: initial 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"
/user:name¶
GET¶
Info
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¶
Info
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:login¶
GET¶
Info
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¶
Info
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¶
Info
Delete a previously generated link.
Input:
- [!] string user: user identification string
- [!] string url: generated login link to be invalidated
/user:search¶
GET¶
Info
Lookup user by email, username or code.
Input:
- [!] string query: query string
Output:
- string user: user identification string
- boolean exam: exam account
Last update: November 6, 2020