KPI Categories / KPIs

These are the KPIs that are associated with the KPI category. And allow you to easily list and manage KPIs within a specific category.

KPI Object

The object has the following properties:

Name Type Read Only Mandatory Max Len. Notes
id integer yes no   Automatically generated for the KPI
category_id integer yes no   The id of the category the KPI is in
image_id integer no yes   The id of the icon to assign to the KPI
format_id integer no yes   The id of the format of measure to assign to the KPI
frequency character no yes 1 The id of the frequency of data entry for the KPI. This field is case sensitive and must be uppercase.
name string no yes 100 The name of the KPI
description string no no 150 The description of the KPI
target decimal no no   The default target value for the KPI. If left blank or null the KPI will not have a target
direction character no yes 1 The value direction is case sensitive and can only be U(p), D(own) and N(one)
aggregate string no yes 3 The aggregate function determines how the KPI is calculated and can be either AVG (Average) or SUM (Total Sum).
disable boolean no yes   Active KPIs can have date entered against them otherwise they are display only KPIs
calculated boolean yes no   Calculated KPIs cannot be amended via the API and must be added / amended in the interface

JSON Example

{
  "id":                 111,
  "category_id":        222,
  "icon_id":            1,
  "unit_id":            11,
  "frequency_id":       "M",
  "name":               "Number of Sales",
  "description":        "Kpi description",
  "target_default":     null,
  "value_direction":    "N",
"aggregate_function": "SUM", "is_active": true, "calculated": false, }

XML Example

<KPI xmlns="http://schemas.datacontract.org/2004/07/Waytobi.App.Api.Models" 
     xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
  <id>111</id>
  <category_id>222</category_id>
  <icon_id>1</icon_id>
  <unit_id>11</unit_id>
  <frequency_id>M</frequency_id>
  <name>Number of Sales</name>
  <description>Kpi description</description>
  <target_default>null</target_default>
  <value_direction>N</value_direction>
<aggregate_function>SUM</aggregate_function> <is_active>true</is_active> <calculated>false</is_calculated> </KPI>

 

Get all KPIs in the Category

GET /api/kpicategories/{category_id}/kpis

Using curl

curl https://app.waytobi.com/api/kpicategories/{category_id}/kpis
  -v -u {token}

Example Response

Status: 200 OK
[
  {
"id": 111,
"category_id": 222,
"icon_id": 1,
"unit_id": 11,
"frequency_id": "M",
"name": "Number of Sales",
"description": "Kpi description",
"target_default": null,
"value_direction": "N",
"aggregate_function": "SUM",
"is_active": true,
"calculated": false,
},
{
"id": 112,
"category_id": 223,
"icon_id": 4,
"unit_id": 2,
"frequency_id": "D",
"name": "Calls",
"description": "Calls kpi description",
"target_default": null,
"value_direction": "N",
"aggregate_function": "SUM",
"is_active": true,
"calculated": false,
} ]

 

Get a KPI in the Category

GET /api/kpicategories/{category_id}/kpis/{id}

Using curl

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

Example Response

Status: 200 OK
{
"id": 111,
"category_id": 222,
"icon_id": 1,
"unit_id": 11,
"frequency_id": "M",
"name": "Number of Sales",
"description": "Kpi description",
"target_default": null,
"value_direction": "N",
"aggregate_function": "SUM",
"is_active": true,
"calculated": false,
}

 

Add a KPI to the Category

POST /api/kpicategories/{category_id}/kpis

Using curl

curl https://app.waytobi.com/api/kpicategories/{category_id}/kpis
  -H "Content-Type: application/json" 
  -d '{"icon_id":1, "unit_id":11, "frequency_id":"M", "name":"Number of Sales", 
       "description":"New description", "target_default":100, "value_direction":"N",
       "is_active":true}'
  -v -u {token} -X POST

Example Response

Status: 201 Created
Location: https://app.waytobi.com/api/kpicategories/{category_id}/kpis/{id}
{
"id": 111,
"category_id": 222,
"icon_id": 1,
"unit_id": 11,
"frequency_id": "M",
"name": "Number of Sales",
"description": "New description",
"target_default": 100,
"value_direction": "N",
"aggregate_function": "SUM",
"is_active": true,
"calculated": false,
}

 

Update a KPI in the Category

PUT /api/kpicategories/{category_id}/kpis/{id}

Using curl

curl https://app.waytobi.com/api/kpicategories/{category_id}/kpis/{id}
  -H "Content-Type: application/json" 
  -d '{"icon_id":1, "unit_id":11, "frequency_id":"M", "name":"Number of Sales", 
       "description":"New description", "target_default":100, "value_direction":"N",
       "is_active":true}'
  -v -u {token} -X PUT

Example Response

Status: 200 OK
{
"id": 111,
"category_id": 222,
"icon_id": 1,
"unit_id": 11,
"frequency_id": "M",
"name": "Number of Sales",
"description": "New description",
"target_default": 100,
"value_direction": "N",
"aggregate_function": "SUM",
"is_active": true,
"calculated": false,
}

 

Delete a KPI in the Category

DELETE /api/kpicategories/{category_id}/kpis/{id}

Using curl

curl https://app.waytobi.com/api/kpicategories/{category_id}/kpis/{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