Users

Model & Relations

Namespace

App\User

Relations

Relation Key Type Relation Field(s)
Role role Belongs to role_id

Computed Properties

  • full_name - Concatenated from first_name and last_name
  • online - Wether the the User is online

List

Get a list of all Users.

Definition

GET /api/users

Example Request

$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('GET', '/api/users', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);

Example Response

[
  {
    "id": 3,
    "username": "usergroup.01",
    "first_name": "",
    "last_name": "",
    "active": 1,
    "group_account": 1,
    "role_id": 2,
    "profile_picture": "/assets/images/profile-pictures/profile-picture-group-account-default.png",
    "street": null,
    "zipcode": null,
    "city": null,
    "email": null,
    "phone": null,
    "birthdate": null,
    "gender": null,
    "entering_date": null,
    "leaving_date": null,
    "staff_number": null,
    "wants_email_notifications": 0,
    "created_at": "2019-01-21 13:56:47",
    "updated_at": "2019-01-21 13:56:47",
    "password_updated_at": "2019-01-21 13:56:47",
    "deleted_at": null,
    "default_route": "",
    "full_name": " ",
    "online": 0,
    "role": {
      "id": 2,
      "department_id": 2,
      "name": "Usergroup-1",
      "department": {
        "id": 2,
        "name": "Usergroup-1"
      }
    }
  },
  {
    "id": 4,
    "username": "usergroup.02",
    "first_name": "",
    "last_name": "",
    "active": 1,
    "group_account": 1,
    "role_id": 3,
    "profile_picture": "/assets/images/profile-pictures/profile-picture-group-account-default.png",
    "street": null,
    "zipcode": null,
    "city": null,
    "email": null,
    "phone": null,
    "birthdate": null,
    "gender": null,
    "entering_date": null,
    "leaving_date": null,
    "staff_number": null,
    "wants_email_notifications": 0,
    "created_at": "2019-01-21 13:57:04",
    "updated_at": "2019-01-21 13:57:04",
    "password_updated_at": "2019-01-21 13:57:04",
    "deleted_at": null,
    "default_route": "",
    "full_name": " ",
    "online": 0,
    "role": {
      "id": 3,
      "department_id": 3,
      "name": "Usergroup-2",
      "department": {
        "id": 3,
        "name": "Usergroup-2"
      }
    }
  }
]

Get

Get a single User by id.

Definition

GET /api/users/{id}

Example Request

$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('GET', '/api/users/3', [
    'headers' => ['Authorization' => "Bearer {accessToken}"]
]);

Example Response

{
  "id": 3,
  "username": "usergroup.01",
  "first_name": "",
  "last_name": "",
  "active": 1,
  "group_account": 1,
  "role_id": 2,
  "profile_picture": "/assets/images/profile-pictures/profile-picture-group-account-default.png",
  "street": null,
  "zipcode": null,
  "city": null,
  "email": null,
  "phone": null,
  "birthdate": null,
  "gender": null,
  "entering_date": null,
  "leaving_date": null,
  "staff_number": null,
  "wants_email_notifications": 0,
  "created_at": "2019-01-21 13:56:47",
  "updated_at": "2019-01-21 13:56:47",
  "password_updated_at": "2019-01-21 13:56:47",
  "deleted_at": null,
  "default_route": "",
  "full_name": " ",
  "online": 0,
  "role": {
    "id": 2,
    "department_id": 2,
    "name": "Usergroup-1",
    "department": {
      "id": 2,
      "name": "Usergroup-1"
    }
  }
}

Create

Create a new User.

Definition

POST /api/users

Request Keys

Key Type Default Description
username * string - The username of the User (min. 4 characters)
password * string - The password for the User (min. 6 characters)
first_name * string - First name of this User
last_name * string - Last name of this User
active boolean true Whether the User is active
group_account boolean 0 Whether the User is a Group Account
role_id * integer - Related Role
request_password_change boolean - Whether the password should be changed by the User on the next login
profile_picture string null The profile picture URL of this User. The image itself needs to be uploaded before
street string null Street where the User lives at
zipcode string null Zipcode of the city the User lives in
city string null City where the User lives in
email email null Email of the User
phone string null Phone number of the User
birthday date null Birthday of the User
gender string null Gender of the User (female or male)
entering_date date null Date when the User enteres/entered the company
leaving_date date null Date when the User leaves/left the company
staff_number string null The identification number of the User inside a company
wants_email_notifications boolean true Whether the User get's notified about Notifications by email

Keys with * are required.

Example Request

$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('POST', '/api/users', [
     'headers' => ['Authorization' => "Bearer {accessToken}"],
     'json' => [
         'username' => 'jeremy.doe',
         'password' => 'jeremy.doe',
         'first_name' => 'Jeremy',
         'last_name' => 'Doe',
         'role_id' => 3
     ]
 ]);

Example Response

{
  "status": "success",
  "data": {
    "username": "jeremy.doe",
    "first_name": "Jeremy",
    "last_name": "Doe",
    "role_id": "3",
    "group_account": 0,
    "active": 1,
    "profile_picture": "/assets/images/profile-pictures/profile-picture-user-default.png",
    "updated_at": "2019-01-24 18:28:52",
    "created_at": "2019-01-24 18:28:52",
    "id": 8,
    "full_name": "Jeremy Doe",
    "online": 0
  }
}

Update

Update an existing User by id.

Definition

PUT /api/users/{id}

Request Keys

Key Type Description
username string The username of the User (min. 4 characters)
password string The password for the User (min. 6 characters)
first_name string First name of this User
last_name string Last name of this User
active boolean Whether the User is active
group_account boolean Whether the User is a Group Account
role_id integer Related Role
request_password_change boolean Whether the password should be changed by the User on the next login
profile_picture string The profile picture URL of this User. The image itself needs to be uploaded before
street string Street where the User lives at
zipcode string Zipcode of the city the User lives in
city string City where the User lives in
email email Email of the User
phone string Phone number of the User
birthday date Birthday of the User
gender string Gender of the User (female or male)
entering_date date Date when the User enteres/entered the company
leaving_date date Date when the User leaves/left the company
staff_number string The identification number of the User inside a company
wants_email_notifications boolean Whether the User get's notified about Notifications by email

Keys with * are required.

Example Request

$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('PUT', '/api/users/8', [
     'headers' => ['Authorization' => "Bearer {accessToken}"],
     'json' => [
         'role_id' => '2'
     ]
 ]);

Example Response

{
  "status": "success",
  "data": {
    "id": 8,
    "username": "jeremy.doe",
    "first_name": "Jeremy",
    "last_name": "Doe",
    "active": 1,
    "group_account": 0,
    "role_id": "2",
    "profile_picture": "/assets/images/profile-pictures/profile-picture-user-default.png",
    "street": null,
    "zipcode": null,
    "city": null,
    "email": null,
    "phone": null,
    "birthdate": null,
    "gender": null,
    "entering_date": null,
    "leaving_date": null,
    "staff_number": null,
    "wants_email_notifications": 1,
    "created_at": "2019-01-24 18:28:52",
    "updated_at": "2019-01-24 18:33:28",
    "password_updated_at": null,
    "deleted_at": null,
    "default_route": null,
    "full_name": "Jeremy Doe",
    "online": 0
  }
}

Delete

Delete an existing User by id.

Definition

DELETE /api/users/{id}

Example Request

$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);
$response = $client->request('DELETE', '/api/users/8', [
     'headers' => ['Authorization' => "Bearer {accessToken}"]
 ]);

Example Response

{
  "status": "success",
  "data": []
}

Upload Profile Picture

Upload a profile picture to use for a User.

Definition

POST /api/users/profile-picture

Request Keys

Key Type Default Description
profile_picture * file - Profile picture

Keys with * are required.

Example Request

$client = new GuzzleHttp\Client(['base_uri' => 'https://{tenant}.intratool.de']);

Example Response


Last Updated: 10/14/2019