Groups

Groups are used to define grouping of users and user's data or your company hierarchy. The groups may be Countries, Offices, Teams 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 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
name string no yes 50 The name of the group

JSON Example

{
  "id":		1,
  "name":	"City"
}

XML Example

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

 

Get All Groups

GET /api/groups

Using curl

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

Example Response

Status: 200 OK
[
 {
    "id":         1,
    "name":       "City"
  },
  {
    "id":         2,
    "name":       "Country"
  }
]

 

Get a Group

GET /api/groups/{id}

Using curl

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

Example Response

Status: 200 OK
{
  "id":1,
  "name":"City",
  "sort_order":1
}

 

Add a Group

POST /api/groups

Using curl

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

Example Response

Status: 201 Created
Location: https://app.waytobi.com/api/groups/{id}
{
  "id":3,
  "name":"My Group Name"
}

 

Update a Group

PUT /api/groups/{id}

Using curl

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

Example Response

Status: 200 OK
{
  "id":3,
  "name":"My Group Name"
}

 

Delete Group

DELETE /api/groups/{id}

Using curl

curl https://app.waytobi.com/api/groups/{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