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 | 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 | 50 | The name of the group item |
JSON Example
{ "user_id": 111, "id": 222, "group_id": 221, "group_name": "City", "name": "New York", "created_at": "2020-01-11T09:35:00" }
XML Example
<UserGroupItem xmlns="http://schemas.datacontract.org/2004/07/Waytobi.App.Api.Models" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <user_id>111</user_id> <id>222</id> <group_id>221</group_id> <group_name>City</group_name> <name>New York</name> <created_at>2020-01-11T09:35:00</created_at> </UserGroupItem>
Get all User Group Items
GET /api/users/{user_id}/groupitems
Using curl
curl https://app.waytobi.com/api/users/{user_id}/groupitems -v -u {token}
Example Response
Status: 200 OK [ {
"user_id": 111,
"id": 222,
"group_id": 221,
"group_name": "City",
"name": "New York",
"created_at": "2020-01-11T09:35:00"
}, {
"user_id": 111,
"id": 232,
"group_id": 231,
"group_name": "Country",
"name": "USA",
"created_at": "2020-01-11T09:35:00"
} ]
Get a User Group Item
GET /api/users/{user_id}/groupitems/{id}
Using curl
curl https://app.waytobi.com/api/users/{user_id}/groupitems/{id} -v -u {token}
Example Response
Status: 200 OK {
"user_id": 111,
"id": 222,
"group_id": 221,
"group_name": "City",
"name": "New York",
"created_at": "2020-01-11T09:35:00"
}
Add a User Group Item
POST /api/users/{user_id}/groupitems
Using curl
curl https://app.waytobi.com/api/users/{user_id}/groupitems -H "Content-Type: application/json" -d '{"id": "222"}' -v -u {token} -X POST
Example Response
Status: 201 Created Location: https://app.waytobi.com/api/users/{user_id}/groupitems/{id} {
"user_id": 111,
"id": 222,
"group_id": 221,
"group_name": "City",
"name": "New York",
"created_at": "2020-01-11T09:35:00"
}
Delete a User Group Item
DELETE /api/users/{user_id}/groupitems/{id}
Using curl
curl https://app.waytobi.com/api/users/{user_id}/groupitems/{id} -v -u {token}
Example Response
Status: 200 OK