Skip to content

Users API

Goran Nikic edited this page Feb 12, 2018 · 4 revisions

The Users API will allow you to get,update and create users in the Opencinema system.

List All Users

GET /users Returns a Paged Result containing the list of Actors.

Filters

  • "username" - String - "John Smith" - LIKE OPERATION
  • "fname" - String - "John" - LIKE OPERATION
  • "lname" - String - "Smith" - LIKE OPERATION
  • "dob" - String - "yyyy-mm-dd" - LIKE OPERATION
  • "email" - String - "mike@test.com" - LIKE OPERATION
  • "phone" - Integer - "0712512525" - LIKE OPERATION
  • "city" - String - "London" - LIKE OPERATION
  • "country" - String - "United Kingdom" - LIKE OPERATION
  • "status" - Integer - "John Smith" - WHERE OPERATION

Get a User By ID

GET /users/get/:id

Update a User

PATCH /users/create

In order to update a user, the 'fname' is required at minimum. You cannot update a user without sending this field.

The following fields can be updated

  • "fname" - String - Users first name
  • "lname" - String - Users last name
  • "dob" - Users date of birth in yyyy-mm-dd format
  • "email" - String - Users email
  • "phone" - Numeric - Users phone number
  • "city" - String - Users city
  • "country" - String - Users country
  • "authorised" - Integer (0,1) - 0 if the user has not authenticated his account yet, 1 if he has.

Update a User

POST /users/update/:id

Ensure that all of the fields below are sent alongside with the request.

  • "fname" - String - Users first name
  • "lname" - String - Users last name
  • "newPassword" - String - The password which is to be hashed
  • "dob" - Users date of birth in yyyy-mm-dd format
  • "email" - String - Users email
  • "phone" - Numeric - Users phone number
  • "city" - String - Users city
  • "country" - String - Users country
  • "authorised" - Integer (0,1) - 0 if the user has not authenticated his account yet, 1 if he has.

Response

{
    "status": "OK",
    "code": 200,
    "messages": "common.SUCCESSFUL_REQUEST",
    "data": {
        "id": 1,
        "username": "goran",
        "fname": "Goran",
        "lname": "N.",
        "email": "goran@novnik.com",
        "phone": 447168060,
        "city": "Cork",
        "country": "Ireland",
        "last_access": ""
    }
}

Clone this wiki locally