SimpleKPI Logo

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:

NameTypeRead OnlyMandatoryMax Len.Notes
idintegeryesno Automatically assigned when creating a user
user_typestringnoyes The user type must be either 'Admin', 'Director', 'Manager' or 'User'
user_status_idcharacternoyes1The user_status_id can only be (A)ctive or (L)ocked
first_namestringnoyes50The first name of the user
last_namestringnono50The last name of the user
emailstringnoyes150Must be a valid email address and will be used for the login
passwordstringnoyes20The password is only required when adding a new user and cannot be changed via the API
can_manage_usersbooleannoyes This field is only relevant for user types of 'Manager' and will allow a manager to admin the users within the manager's group items
can_admin_settingsbooleannoyes This field is only relevant for user types of 'Admin' and will grant 'Settings' and 'Billing' access
last_login_atdatetimeyesno The UTC date and time the user last logged in
last_password_changed_atdatetimeyesno The UTC date and time the user last changed their password
created_atdatetimeyesno The UTC date and time the user was created
updated_atdatetimeyesno The UTC date and time of the last update of the user

JSON Example

{
  "id":                       1234,
  "user_type":                "Manager",
  "user_status_id":           "A",
  "first_name":               "Jim",
  "last_name":                "Jones",
  "email":                    "jim@simplekpi.com",
  "password":                 null,
  "can_manage_users":         true,
  "can_admin_settings":       false,
  "last_login_at":            "2012-11-10T14:35:00",
  "last_password_changed_at": "2012-12-10T14:35:00",
  "created_at":               "2012-09-10T14:35:00",
  "updated_at":               "2012-11-30T11:01:00"
}

XML Example

<User xmlns="http://schemas.datacontract.org/2004/07/SimpleKPI.Application.Areas.Api.Models"
  xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
    <id>1234</id>
    <user_type>Manager</user_type>
    <user_status_id>A</user_status_id>
    <first_name>Jim</first_name>
    <last_name>Jones</last_name>
    <email>jim@simplekpi.com</email>
    <password>null</password>
    <can_manage_users>true</can_manage_users>
    <can_admin_settings>false</can_admin_settings>
    <last_login_at>2012-11-10T14:35:00</last_login_at>
    <last_password_changed_at>2012-12-10T14:35:00</last_password_changed_at>
    <created_at>2012-09-10T14:35:00</created_at>
    <updated_at>2012-11-30T11:01:00</updated_at>
</User>

 

Get all Users

GET /api/users

Using curl

curl https://{subdomain}.simplekpi.com/api/users
    -v -u {email_address}:{token}
  

Example Response

Status: 200 OK
[
  {
    "id":                       1234,
    "user_type":                "Manager",
    "user_status_id":           "A",
    "first_name":               "Marsy",
    "last_name":                "Barr",
    "email":                    "marsy@simplekpi.com",
    "password":                 null,
    "can_manage_users":         true,
    "can_admin_settings":       false,
    "last_login_at":            "2012-11-10T14:35:00",
    "last_password_changed_at": "2012-12-10T14:35:00",
    "created_at":               "2012-09-10T14:35:00",
    "updated_at":               "2012-11-30T11:01:00"
  },
  {
    "id":                       1235,
    "user_type":                "User",
    "user_status_id":           "A",
    "first_name":               "Toby",
    "last_name":                "Lerone",
    "email":                    "toby@simplekpi.com",
    "password":                 null,
    "can_manage_users":         false,
    "can_admin_settings":       false,
    "last_login_at":            "2013-01-10T15:06:00",
    "last_password_changed_at": "2013-01-10T15:36:00",
    "created_at":               "2012-11-02T15:09:00",
    "updated_at":               "2013-01-10T15:36:00"
  }
]

 

Get a User

GET /api/users/{id}

Using curl

curl https://{subdomain}.simplekpi.com/api/users/{id}
    -v -u {email_address}:{token}
  

Example Response

Status: 200 OK
{
  "id":                       1234,
  "user_type":                "Manager",
  "user_status_id":           "A",
  "first_name":               "Jim",
  "last_name":                "Jones",
  "email":                    "jim@simplekpi.com",
  "password":                 null,
  "can_manage_users":         true,
  "can_admin_settings":       false,
  "last_login_at":            "2012-11-10T14:35:00",
  "last_password_changed_at": "2012-12-10T14:35:00",
  "created_at":               "2012-09-10T14:35:00",
  "updated_at":               "2012-11-30T11:01:00"
}

 

Add a User

POST /api/users

Using curl

curl https://{subdomain}.simplekpi.com/api/users
    -H "Content-Type: application/json"
    -d '{"user_type": "Manager", "user_status_id": "A", "first_name": "Jim", "last_name": "Jones",
        "email": "jim@simplekpi.com", "password": "Password1234", "can_manage_users": true,
        "can_admin_settings": false}'
    -v -u {email_address}:{token} -X POST
  

Example Response

Status: 201 Created
Location: https://{subdomain}.simplekpi.com/api/users/{id}
{
  "id":                       1234,
  "user_type":                "Manager",
  "user_status_id":           "A",
  "first_name":               "Jim",
  "last_name":                "Jones",
  "email":                    "jim@simplekpi.com",
  "password":                 null,
  "can_manage_users":         true,
  "can_admin_settings":       false,
  "last_login_at":            "2012-11-10T14:35:00",
  "last_password_changed_at": "2012-12-10T14:35:00",
  "created_at":               "2012-09-10T14:35:00",
  "updated_at":               "2012-11-30T11:01:00"
}

 

Update a User

PUT /api/users/{id}

Using curl

curl https://{subdomain}.simplekpi.com/api/users/{id}
    -H "Content-Type: application/json"
    -d '{"id": 1234, "user_type": "Manager", "user_status_id": "A", "first_name": "Jim", "last_name": "Jones",
        "email": "jim@simplekpi.com", "can_manage_users": true, "can_admin_settings": false}'
    -v -u {email_address}:{token} -X PUT
  

Example Response

Status: 200 OK
{
  "id":                       1234,
  "user_type":                "Manager",
  "user_status_id":           "A",
  "first_name":               "Jim",
  "last_name":                "Jones",
  "email":                    "jim@simplekpi.com",
  "password":                 null,
  "can_manage_users":         true,
  "can_admin_settings":       false,
  "last_login_at":            "2012-11-10T14:35:00",
  "last_password_changed_at": "2012-12-10T14:35:00",
  "created_at":               "2012-09-10T14:35:00",
  "updated_at":               "2012-11-30T11:01:00"
}

 

Delete a User

DELETE /api/users/{id}

Using curl

curl https://{subdomain}.simplekpi.com/api/users/{id}
    -v -u {email_address}:{token}
  

Example Response

Status: 200 OK