Groups / Group Items

Group items belong to groups and form part of the user grouping or company hierarchy. Possible group item examples for group 'Countries' might be USA, Ukraine, Brazil etc.
Group items are added to a group and can then be assigned to a user. The group items are then used as part of user access rights and to determine how the user's KPI entries are grouped for analytics and reporting purposes.

Group Item Object

The object has the following properties:

Name Type Is Read Only Is Mandatory Max Length Notes
id integer yes no   Automatically assigned when creating a group item
parent_group_id integer no yes   The id of the group the item belongs in
name string no yes 50 The name of the item

JSON Example

{
  "id":         2,
  "group_id":   1,
  "name":       "New York"
}

XML Example

<GroupItem xmlns="http://schemas.datacontract.org/2004/07/Waytobi.App.Api.Models" 
           xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
  <id>2</id>
  <group_id>1</group_id>
  <name>New York</name>
</GroupItem>

 

Get all Group items

GET /api/groups/{group_id}/items

Using curl

curl https://app.waytobi.com/api/groups/{group_id}/items 
  -v -u {token}

Example Response

Status: 200 OK
[
  {
"id": 2, "group_id": 1, "name": "New York" }, { "id": 3, "group_id": 1, "name": "Kiev" } ]

 

Get a Group Item

GET /api/groups/{group_id}/items/{id}

Using curl

curl https://app.waytobi.com/api/groups/{group_id}/items/{id} 
  -v -u {token}

Example Response

Status: 200 OK
{
  "id":         2,
  "group_id":   1,
  "name":       "New York"
}

 

Add a Group Item

POST /api/groups/{group_id}/items

Using curl

curl https://app.waytobi.com/api/groups/{group_id}/items
  -H "Content-Type: application/json" -d '{"name": "My Group item"}'
  -v -u {token} -X POST

Example Response

Status: 201 Created
Location: https://app.waytobi.com/api/groups/{group_id}/items/{id}
{
  "id":         2,
  "group_id":   1,
  "name":       "My Group item"
}

 

Update a Group Item

PUT /api/groups/{group_id}/items/{id}

Using curl

curl https://app.waytobi.com/api/groups/{group_id}/items/{id}
  -H "Content-Type: application/json" -d '{"name": "My Group Item"}'
  -v -u {token} -X PUT

Example Response

Status: 200 OK
{
"id": 2,
"group_id": 1,
"name": "My Group item"
}

 

Delete Group Item

DELETE /api/groups/{group_id}/items/{id}

Using curl

curl https://app.waytobi.com/api/groups/{group_id}/items/{id}
  -v -u {token}

Example Response

Status: 200 OK
 

Unable to find an answer?

Looking for anything specific article which resides in general queries? Just browse the various relevant folders and categories and then you will find the desired article.

Contact Us