Users

These are the main user accounts that give users access to the system. The API will allow for user account changes and access restrictions as needed.

User Object

The object has the following properties:

Name Type Read Only Mandatory Max Len. Notes
id integer yes no   Automatically assigned when creating a user
language_id integer no yes   The id of the Language
role_id integer no yes   The user role must be either (2)Admin, (4)Director, (6)Manager or (10)User
status tinyInteger no yes   The user_status_id can only be (1)Active or (0)Locked
first_name string no yes 50 The first name of the user
last_name string no no 50 The last name of the user
email string no yes 150 Must be a valid email address and will be used for the login
password string no yes 20 The password is only required when adding a new user and cannot be changed via the API
created_at datetime yes no   The UTC date and time the user was created
updated_at datetime yes no   The UTC date and time of the last update of the user

JSON Example

{
  "id":                       111,
  "user_type":                6,
  "user_status_id":           1,
  "first_name":               "Jon",
  "last_name":                "Snow",
  "email":                    "jon@wayotbi.com",
  "password":                 null,
  "created_at":               "2020-04-15T12:15:00",
  "updated_at":               "2020-09-20T15:21:00"
}

XML Example

<User xmlns="http://schemas.datacontract.org/2004/07/Waytobi.App.Api.Models"
xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
  <id>111</id>
  <user_type>6</user_type>
  <user_status_id>1</user_status_id>
  <first_name>Jon</first_name>
  <last_name>Snow</last_name>
  <email>jon@wayotbi.com</email>
  <password>null</password>
  <created_at>2020-04-15T12:15:00</created_at>
  <updated_at>2020-09-20T15:21:00</updated_at>
</User>

 

Get all Users

GET /api/users

Using curl

curl https://app.waytobi.com/api/users
  -v -u {token}

Example Response

Status: 200 OK
[
  {
    "id":                       111,
    "user_type":                6,
    "user_status_id":           1,
    "first_name":               "Jon",
    "last_name":                "Snow",
    "email":                    "jon@waytobi.com",
    "password":                 null,
    "created_at":               "2020-04-15T12:15:00",
    "updated_at":               "2020-09-20T15:21:00"
  },
  {
    "id":                       112,
    "user_type":                10,
    "user_status_id":           1,
    "first_name":               "Alex",
    "last_name":                "Rain",
    "email":                    "alex@waytobi.com",
    "password":                 null,
    "created_at":               "2020-02-11T10:35:00",
    "updated_at":               "2020-04-25T08:46:00"
  }
]

 

Get a User

GET /api/users/{id}

Using curl

curl https://app.waytobi.com/api/users/{id}
  -v -u {token}

Example Response

Status: 200 OK
{
  "id": 111,
"user_type": 6,
"user_status_id": 1,
"first_name": "Jon",
"last_name": "Snow",
"email": "jon@waytobi.com",
"password": null,
"created_at": "2020-04-15T12:15:00",
"updated_at": "2020-09-20T15:21:00" }

 

Add a User

POST /api/users

Using curl

curl https://app.waytobi.com/api/users
  -H "Content-Type: application/json"
  -d '{"user_type": 6, "user_status_id": 1, "first_name": "Jon", "last_name": "Snow",
       "email": "jon@waytobi.com", "password": "Password123"}'
  -v -u {token} -X POST

Example Response

Status: 201 Created
Location: https://app.waytobi.com/api/users/{id}
{
  "id": 111,
"user_type": 6,
"user_status_id": 1,
"first_name": "Jon",
"last_name": "Snow",
"email": "jon@waytobi.com",
"password": null,
"created_at": "2020-04-15T12:15:00",
"updated_at": "2020-09-20T15:21:00" }

 

Update a User

PUT /api/users/{id}

Using curl

curl https://app.waytobi.com/api/users/{id}
  -H "Content-Type: application/json"
  -d '{"user_type": 6, "user_status_id": 1, "first_name": "Jon", "last_name": "Snow",
"email": "jon@waytobi.com", "password": "Password123"}' -v -u {token} -X PUT

Example Response

Status: 200 OK
{
  "id": 111,
"user_type": 6,
"user_status_id": 1,
"first_name": "Jon",
"last_name": "Snow",
"email": "jon@waytobi.com",
"password": null,
"created_at": "2020-04-15T12:15:00",
"updated_at": "2020-09-20T15:21:00" }

 

Delete a User

DELETE /api/users/{id}

Using curl

curl https://app.waytobi.com/api/users/{id}
  -v -u {token}

Example Response

Status: 200 OK
 

Unable to find an answer?

Looking for anything specific article which resides in general queries? Just browse the various relevant folders and categories and then you will find the desired article.

Contact Us