KPI Units

The KPI units are used to describe and set how the KPI data values are displayed to the user. For example £ 3.99 , 123% etc.

KPI Unit Object

The object has the following properties:

NameTypeRead OnlyMandatoryMax Len.Notes
id integer yes no   Automatically generated for the KPI unit
name string no yes 25 The name of the KPI unit
entry_format string no yes 25 The entry format is only for entry and will not have the prefix or suffix. e.g. #.00. It can only contain '0', '#' or '.'
display_format string no yes 25 The display format must be a valid number format e.g. £ #.00 or #.00%
is_percentage boolean no yes   To determine if the value is a percentage as these values are treated differently in the application
created_at datetime yes no   The date and time the KPI unit was created
updated_at date yes no   The date and time of the last update of the KPI unit

JSON Example

{
  "id":             12,
  "name":           "12.34%",
  "entry_format":   "0.00",
  "display_format": "0.00%",
  "is_percentage":  true,
  "created_at":     "2012-09-10T14:29:00",
  "updated_at":     "2012-09-10T14:29:00"
}

XML Example

<KPIUnit xmlns="http://schemas.datacontract.org/2004/07/SimpleKPI.Application.Areas.Api.Models" 
          xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
  <id>12</id>
	<name>12.34%</name>
  <entry_format>0.00</entry_format>
  <display_format>0.00%</display_format>
  <is_percentage>true</is_percentage>
  <created_at>2012-09-10T14:29:00</created_at>
  <updated_at>2012-09-10T14:29:00</updated_at>
</KPIUnit>

 

Get all KPI Units

GET /api/kpiunits

Using curl

curl https://{subdomain}.simplekpi.com/api/kpiunits
  -v -u {email_address}:{token}

Example Response

Status: 200 OK
[
  {
    "id":             12,
    "name":           "12.34%",
    "entry_format":   "0.00",
    "display_format": "0.00%",
    "is_percentage":  true,
    "created_at":     "2012-09-10T14:29:00",
    "updated_at":     "2012-09-10T14:29:00"
  },
  {
    "id":             13,
    "name":           "£ 12.34",
    "entry_format":   "#.00",
    "display_format": "£ #,###.00",
    "is_percentage":  true,
    "created_at":     "2012-09-10T14:29:00",
    "updated_at":     "2012-09-10T14:29:00"
  }
]

 

Get a KPI Unit

GET /api/kpiunits/{id}

Using curl

curl https://{subdomain}.simplekpi.com/api/kpiunits/{id}
  -v -u {email_address}:{token}

Example Response

Status: 200 OK
{
  "id":             12,
  "name":           "12.34%",
  "entry_format":   "0.00",
  "display_format": "0.00%",
  "is_percentage":  true,
  "created_at":     "2012-09-10T14:29:00",
  "updated_at":     "2012-09-10T14:29:00"
}

 

Add a KPI Unit

POST /api/kpiunits

Using curl

curl https://{subdomain}.simplekpi.com/api/kpiunits
  -H "Content-Type: application/json" 
  -d '{"name":"12.34%", "entry_format":"0.00", "display_format":"0.00%", "is_percentage":true}'
  -v -u {email_address}:{token} -X POST

Example Response

Status: 201 Created
Location: https://{subdomain}.simplekpi.com/api/kpiunits/{id}
{
  "id":             12,
  "name":           "12.34%",
  "entry_format":   "0.00",
  "display_format": "0.00%",
  "is_percentage":  true,
  "created_at":     "2012-09-10T14:29:00",
  "updated_at":     "2012-09-10T14:29:00"
}

 

Update a KPI Unit

PUT /api/kpiunits/{id}

Using curl

curl https://{subdomain}.simplekpi.com/api/kpiunits/{id}
  -H "Content-Type: application/json" 
  -d '{"name":"12.34%", "entry_format":"0.00", "display_format":"0.00%", "is_percentage":true}'
  -v -u {email_address}:{token} -X PUT

Example Response

Status: 200 OK
{
  "id":             12,
  "name":           "12.34%",
  "entry_format":   "0.00",
  "display_format": "0.00%",
  "is_percentage":  true,
  "created_at":     "2012-09-10T14:29:00",
  "updated_at":     "2012-09-10T14:29:00"
}

 

Delete a KPI Unit

DELETE /api/kpiunits/{id}

Using curl

curl https://{subdomain}.simplekpi.com/api/kpiunits/{id}
  -v -u {email_address}:{token}

Example Response

Status: 200 OK