Developer API
Users / Group Items
The user can be assigned to group items which will group their entry data for analytics and reporting. All group items assigned to a user will automatically be assigned to a KPI entry when adding a new data entry.
User Group Item Object
The object has the following properties:
Name | Type | Read Only | Mandatory | Max Len. | Notes |
---|---|---|---|---|---|
user_id | integer | yes | no | Id of the user assigned to the group item | |
id | integer | no | yes | The id of the group item to assign to the user | |
group_id | integer (16 bit) | yes | no | The id of the group the item is in | |
group_name | string | yes | no | 50 | The name of the group |
name | string | yes | no | 100 | The name of the group item |
created_at | datetime | yes | no | The UTC date and time the item was created |
JSON Example
{ "user_id": 1234, "id": 2265, "group_id": 1, "group_name": "Departments", "name": "Sales", "created_at": "2013-02-21T16:05:00" }
XML Example
<UserGroupItem xmlns="http://schemas.datacontract.org/2004/07/SimpleKPI.Application.Areas.Api.Models" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <user_id>1234</user_id> <id>2265</id> <group_id>1</group_id> <group_name>Departments</group_name> <name>Sales</name> <created_at>2013-02-21T16:05:00</created_at> </UserGroupItem>
Get all User Group Items
GET /api/users/{user_id}/groupitems
Using curl
curl https://{subdomain}.simplekpi.com/api/users/{user_id}/groupitems -v -u {email_address}:{token}
Example Response
Status: 200 OK [ { "user_id": 1234, "id": 2265, "group_id": 1, "group_name": "Departments", "name": "Sales", "created_at": "2013-02-21T16:05:00" }, { "user_id": 1234, "id": 2266, "group_id": 2, "group_name": "Offices", "name": "Scotland", "created_at": "2013-02-21T16:05:00" } ]
Get a User Group Item
GET /api/users/{user_id}/groupitems/{id}
Using curl
curl https://{subdomain}.simplekpi.com/api/users/{user_id}/groupitems/{id} -v -u {email_address}:{token}
Example Response
Status: 200 OK { "user_id": 1234, "id": 2265, "group_id": 1, "group_name": "Departments", "name": "Sales", "created_at": "2013-02-21T16:05:00" }
Add a User Group Item
POST /api/users/{user_id}/groupitems
Using curl
curl https://{subdomain}.simplekpi.com/api/users/{user_id}/groupitems -H "Content-Type: application/json" -d '{"id": "2269"}' -v -u {email_address}:{token} -X POST
Example Response
Status: 201 Created Location: https://{subdomain}.simplekpi.com/api/users/{user_id}/groupitems/{id} { "user_id": 1234, "id": 2265, "group_id": 1, "group_name": "Departments", "name": "Sales", "created_at": "2013-02-21T16:05:00" }
Delete a User Group Item
DELETE /api/users/{user_id}/groupitems/{id}
Using curl
curl https://{subdomain}.simplekpi.com/api/users/{user_id}/groupitems/{id} -v -u {email_address}:{token}
Example Response
Status: 200 OK