These are the KPIs that are assigned to a user. This determines what KPIs the user can enter data against and what KPIs the user can analyze. It also sets the target for the User KPI if the user has a target that is different to the default KPI target.
User KPI Object
The object has the following properties:
Name | Type | Read Only | Mandatory | Max Len. | Notes |
---|---|---|---|---|---|
id | integer | no | yes | The id of the KPI to assign to the user | |
user_id | integer | yes | no | Id of the user assigned to the KPI | |
user_target | decimal | no | no | The user target is only set if the KPI has a target | |
created_at | datetime | yes | no | The UTC date and time the item was created | |
updated_at | datetime | yes | no | The UTC date and time of the last update of the item |
JSON Example
{ "id": 111, "user_id": 222, "user_target": 100, "created_at": "2012-10-17T13:23:00", "updated_at": "2012-10-17T13:23:00" }
XML Example
<UserKPI xmlns="http://schemas.datacontract.org/2004/07/Waytobi.App.Api.Models" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <id>111</id> <user_id>222</user_id> <user_target>100</user_target> <created_at>2012-10-17T13:23:00</created_at> <updated_at>2012-10-17T13:23:00</updated_at> </UserKPI>
Get all User's KPIs
GET /api/users/{user_id}/kpis
Using curl
curl https://app.waytobi.com/api/users/{user_id}/kpis -v -u {token}
Example Response
Status: 200 OK [ { "id": 111, "user_id": 222, "user_target": 100, "created_at": "2012-10-17T13:23:00", "updated_at": "2012-10-17T13:23:00" }, { "id": 112, "user_id": 223, "user_target": 200, "created_at": "2012-10-17T13:23:00", "updated_at": "2012-10-17T13:23:00" } ]
Get a User's KPI
GET /api/users/{user_id}/kpis/{id}
Using curl
curl https://app.waytobi.com/api/users/{user_id}/kpis/{id} -v -u {token}
Example Response
Status: 200 OK {
"id": 111,
"user_id": 222,
"user_target": 100,
"created_at": "2012-10-17T13:23:00",
"updated_at": "2012-10-17T13:23:00"
}
Add a User's KPI
POST /api/users/{user_id}/kpis
Using curl
curl https://app.waytobi.com/api/users/{user_id}/kpis -H "Content-Type: application/json" -d '{"id": "111", "user_target": 100}' -v -u {token} -X POST
Example Response
Status: 201 Created Location: https://app.waytobi.com/api/users/{user_id}/kpis/{id} { "id": 111, "user_id": 222, "user_target": 100, "created_at": "2012-10-17T13:23:00", "updated_at": "2012-10-17T13:23:00" }
Update a User's KPI
PUT /api/users/{user_id}/kpis/{id}
Using curl
curl https://app.waytobi.com/api/users/{user_id}/kpis/{id} -H "Content-Type: application/json" -d '{"user_target": 100}' -v -u {token} -X PUT
Example Response
Status: 200 OK {
"id": 111,
"user_id": 222,
"user_target": 100,
"created_at": "2012-10-17T13:23:00",
"updated_at": "2012-10-17T13:23:00"
}
Delete a User's KPI
DELETE /api/users/{user_id}/kpis/{id}
Using curl
curl https://app.waytobi.com/api/users/{user_id}/kpis/{id} -v -u {token}
Example Response
Status: 200 OK