KPI Entries

These are the KPI data entries added by a user for a specific date based on the entry frequency. The user's group items are associated with the KPI entry on adding a new entry. KPI Entries are removed permanently with their associated group items when deleted.

KPI Entry Object

The object has the following properties:

NameTypeRead OnlyMandatoryMax Len.Notes
id integer yes no   Automatically generated for the KPI entry
user_id integer no yes   An id of an active user to assign to the KPI entry
kpi_id integer no yes   The kpi must be active and cannot be a calculated KPI. The KPI must also be assigned to the user
entry_date datetime no yes   The date of the entry
actual decimal no no   The actual value cannot be null if the target and notes are both null
target decimal no no   The target value of the entry. This value will be ignored if the KPI has a null target
notes string no no 500 The note associated with the KPI entry
created_at datetime yes no   The UTC date and time the KPI entry was created
updated_at datetime yes no   The UTC date and time the KPI entry was updated

JSON Example

{
  "id":         12345,
  "user_id":    1234,
  "kpi_id":     5678,
  "entry_date": "2012-06-25T00:00:00",
  "actual":     50.0000,
  "target":     110.0000,
  "notes":      "This is a note",
  "created_at": "2012-11-30T11:20:00",
  "updated_at": "2013-02-15T16:01:00"
}

XML Example

<KPIEntry xmlns="http://schemas.datacontract.org/2004/07/SimpleKPI.Application.Areas.Api.Models" 
        xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
  <id>12345</id>
  <user_id>1234</user_id>
  <kpi_id>5678</kpi_id>
  <entry_date>2012-06-25T00:00:00</entry_date>
  <actual>50.0000</actual>
  <target>110.0000</target>
  <notes>This is a note</notes>
  <created_at>2013-02-21T10:12:00</created_at>
  <updated_at>2013-02-21T10:12:00</updated_at>
</KPIEntry>

 

Get all KPI entries

The KPI entries are filtered based on the search query string. All the search criteria is optional and we will return a maximum of 500 entries per page. If the result set has the amount of rows you set &rows=100, it's your responsibility to check the next page to see if there are any more -- you do this by adding &page=2 to the query, then &page=3 and so on.

GET /api/kpientries?userid=123&kpiid=456&dateFrom=YYYY-MM-DD&dateTo=YYYY-MM-DD&rows=100&page=2

Using curl

curl https://{subdomain}.simplekpi.com/api/kpientries?userid=123&kpiid=456&dateFrom=2012-01-01&dateTo=2012-02-01
  -v -u {email_address}:{token}

Example Response

Status: 200 OK
[
  {
    "id":         12345,
    "user_id":    1234,
    "kpi_id":     5678,
    "entry_date": "2012-06-25T00:00:00",
    "actual":     50.0000,
    "target":     110.0000,
    "notes":      "This is a note",
    "created_at": "2012-11-30T11:20:00",
    "updated_at": "2013-02-15T16:01:00"
  },
  {
    "id":         12346,
    "user_id":    1235,
    "kpi_id":     5679,
    "entry_date": "2012-08-25T00:00:00",
    "actual":     55.0000,
    "target":     10.0000,
    "notes":      "This is a note",
    "created_at": "2012-11-30T11:20:00",
    "updated_at": "2013-02-15T16:01:00"
  }
]

 

Get a KPI Entry

GET /api/kpientries/{id}

Using curl

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

Example Response

Status: 200 OK
{
  "id":         12345,
  "user_id":    1234,
  "kpi_id":     5678,
  "entry_date": "2012-06-25T00:00:00",
  "actual":     50.0000,
  "target":     110.0000,
  "notes":      "This is a note",
  "created_at": "2012-11-30T11:20:00",
  "updated_at": "2013-02-15T16:01:00"
}

 

Add a KPI Entry

POST /api/kpientries

Using curl

curl https://{subdomain}.simplekpi.com/api/kpientries
  -H "Content-Type: application/json" 
  -d '{"user_id": 1234, "kpi_id": 5678, "entry_date": "2012-06-25T00:00:00", "actual": 50.0000, 
       "target": 110.0000, "notes": "This is a note"}'
  -v -u {email_address}:{token} -X POST

Example Response

Status: 201 Created
Location: https://{subdomain}.simplekpi.com/api/kpientries/{id}
{
  "id":         12345,
  "user_id":    1234,
  "kpi_id":     5678,
  "entry_date": "2012-06-25T00:00:00",
  "actual":     50.0000,
  "target":     110.0000,
  "notes":      "This is a note",
  "created_at": "2012-11-30T11:20:00",
  "updated_at": "2013-02-15T16:01:00"
}

 

Update a KPI Entry

PUT /api/kpientries/{id}

Using curl

curl https://{subdomain}.simplekpi.com/api/kpientries/{id}
  -H "Content-Type: application/json" 
  -d '{"user_id": 1234, "kpi_id": 5678, "entry_date": "2012-06-25T00:00:00", "actual": 50.0000, 
       "target": 110.0000, "notes": "This is a note"}'
  -v -u {email_address}:{token} -X PUT

Example Response

Status: 200 OK
{
  "id":         12345,
  "user_id":    1234,
  "kpi_id":     5678,
  "entry_date": "2012-06-25T00:00:00",
  "actual":     50.0000,
  "target":     110.0000,
  "notes":      "This is a note",
  "created_at": "2012-11-30T11:20:00",
  "updated_at": "2013-02-15T16:01:00"
}

 

Delete a KPI Entry

DELETE /api/kpientries/{id}

Using curl

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

Example Response

Status: 200 OK