# SimpleKPI Classic

> Record and read KPI data in SimpleKPI Classic, and manage KPIs, categories and who enters them.

App · 25 actions. Web page: https://docs.lodol.com/docs/integrations/simplekpi-classic

## Actions

### Add or update KPI entry

Record an actual or target for a user's KPI on a date, updating the entry if one exists.

**Inputs**

- KPI (`kpi_id`, number, required): The KPI to record against. It must be active, not calculated, and assigned to the user.
- Date (`entry_date`, date, required): The date the value is for.
- User (`user`, number): The user to record it against. Give this or User email.
- User email (`email`, text): Or the user's sign-in email, instead of User.
- Actual (`actual`, number): The actual value.
- Target (`target`, number): The target. Ignored when the KPI has no target.
- Notes (`notes`, text): A note for the entry, up to 500 characters.
- Write actual (`setActual`, true/false): Leave on to write Actual; turn off to keep the stored actual.
- Write target (`setTarget`, true/false): Leave on to write Target; turn off to keep the stored target.
- Write notes (`setNotes`, true/false): Leave on to write Notes; turn off to keep the stored notes.
- Add to actual (`addToActual`, true/false): Turn on to add Actual to the stored value instead of replacing it.

**Outputs**

- `data` (object): The response from SimpleKPI Classic.

**Example output**

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

### Add or update many KPI entries

Record up to 5,000 actuals or targets in one go, updating any that exist.

**Inputs**

- Entries (`entries`, list, required): The entries to write. Each needs a KPI, a date, and a user or user email.
- Write actuals (`hasActuals`, true/false): Leave on to write actual values; turn off to keep the stored ones.
- Write targets (`hasTargets`, true/false): Leave on to write targets; turn off to keep the stored ones.
- Write notes (`hasNotes`, true/false): Leave on to write notes; turn off to keep the stored ones.

**Outputs**

- `data` (object): The response from SimpleKPI Classic.

**Example output**

```json
{
  "data": {
    "rows_added": 2
  }
}
```

### Assign KPI to user

Let a user enter data against a KPI, optionally with their own target.

**Inputs**

- User (`user`, number, required): The user to assign the KPI to.
- KPI (`id`, number, required): The KPI to assign.
- Position (`sort_order`, number, required): Where the KPI sits on the user's entry screen.
- User's target (`user_target`, number): Their own target, when the KPI has one and theirs differs from the default.

**Outputs**

- `data` (object): The response from SimpleKPI Classic.

**Example output**

```json
{
  "data": {
    "created_at": "2012-11-15T17:03:00",
    "id": 1234,
    "sort_order": 1,
    "updated_at": "2012-11-15T17:03:00",
    "user_id": 5678,
    "user_target": 123
  }
}
```

### Create category

Add a KPI category.

**Inputs**

- Name (`name`, text, required): What the category is called, up to 50 characters.
- Position (`sort_order`, number, required): Where the category sits in the list.

**Outputs**

- `data` (object): The response from SimpleKPI Classic.

**Example output**

```json
{
  "data": {
    "created_at": "2013-02-21T10:12:00",
    "id": 1234,
    "name": "Sales Category",
    "sort_order": 1,
    "updated_at": "2013-02-21T10:12:00"
  }
}
```

### Create KPI

Add a KPI to a category.

**Inputs**

- Category (`category_id`, number, required): The category the KPI goes in.
- Name (`name`, text, required): What the KPI is called, up to 100 characters.
- Frequency (`frequency_id`, text, required): How often data is entered against it.
- Icon (`icon_id`, number, required): The icon shown with the KPI.
- Unit (`unit_id`, number, required): How its values are shown.
- Good direction (`value_direction`, text, required): Which way the KPI has to move to be doing well. One of: `U` (Up is good), `D` (Down is good), `N` (Neither).
- Roll-up (`aggregate_function`, text, required): How its values are totalled. One of: `SUM` (Total (sum)), `AVG` (Average).
- Position (`sort_order`, number, required): Where the KPI sits in the list.
- Active (`is_active`, true/false, required): Turn on so data can be entered against it; off makes it display only.
- Description (`description`, text): Text shown with the KPI, up to 150 characters.
- Default target (`target_default`, number): The default target. Leave empty for a KPI with no target.

**Outputs**

- `data` (object): The response from SimpleKPI Classic.

**Example output**

```json
{
  "data": {
    "aggregate_function": "SUM",
    "category_id": 5478,
    "created_at": "2013-02-21T10:57:00",
    "description": "This is the description",
    "frequency_id": "W",
    "icon_id": 1,
    "id": 1234,
    "is_active": true,
    "is_calculated": false,
    "name": "Sales KPI",
    "sort_order": 1,
    "target_default": 100,
    "unit_id": 123,
    "updated_at": "2013-02-21T10:58:00",
    "value_direction": "N"
  }
}
```

### Delete category

Delete a KPI category.

**Inputs**

- Category (`id`, number, required): The category to delete.

**Outputs**

- `data` (object): The response from SimpleKPI Classic.

**Example output**

```json
{
  "data": {}
}
```

### Delete KPI

Delete a KPI.

**Inputs**

- KPI (`id`, number, required): The KPI to delete.

**Outputs**

- `data` (object): The response from SimpleKPI Classic.

**Example output**

```json
{
  "data": {}
}
```

### Delete KPI entry

Delete one KPI entry for good.

**Inputs**

- Entry ID (`id`, number, required): The entry to delete, from List KPI entries.

**Outputs**

- `data` (object): The response from SimpleKPI Classic.

**Example output**

```json
{
  "data": {}
}
```

### Get KPI

Get one KPI by its ID.

**Inputs**

- KPI (`id`, number, required): The KPI to get.

**Outputs**

- `data` (object): The response from SimpleKPI Classic.

**Example output**

```json
{
  "data": {
    "aggregate_function": "SUM",
    "category_id": 5478,
    "created_at": "2013-02-21T10:57:00",
    "description": "This is the description",
    "frequency_id": "W",
    "icon_id": 1,
    "id": 1234,
    "is_active": true,
    "is_calculated": false,
    "name": "Sales KPI",
    "sort_order": 1,
    "target_default": 100,
    "unit_id": 123,
    "updated_at": "2013-02-21T10:58:00",
    "value_direction": "N"
  }
}
```

### Get KPI entry

Get one KPI entry by its ID.

**Inputs**

- Entry ID (`id`, number, required): The entry to get, from List KPI entries.

**Outputs**

- `data` (object): The response from SimpleKPI Classic.

**Example output**

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

### Get report data

Get the processed values behind SimpleKPI's reports, calculated KPIs included, for a date range.

**Inputs**

- KPIs (`kpiIds`, list): The KPIs to report on.
- From (`dateFrom`, date): Start of the range. SimpleKPI uses today if left empty.
- To (`dateTo`, date): End of the range. SimpleKPI uses today if left empty.
- Group items (`groupItemIds`, list): Only data for these group items.
- Users (`userIds`, list): Only data for these users.

**Outputs**

- `data` (list): The response from SimpleKPI Classic.

**Example output**

```json
{
  "data": [
    {
      "actual": 144.3822,
      "direction": "U",
      "directionName": "Up",
      "entryDate": "2021-01-10",
      "hasTarget": 1,
      "isPercentage": 0,
      "itemId": 54321,
      "itemName": "Joe Bloggs",
      "kpiDescription": "Sales KPI Description",
      "kpiId": 12345,
      "kpiName": "Sales",
      "labelFormat": "#,##0",
      "notes": "This is a note",
      "period": "Daily",
      "periodId": "D",
      "target": 151
    }
  ]
}
```

### List categories

List the categories your KPIs are organised in.

**Inputs**: None.

**Outputs**

- `data` (list): The response from SimpleKPI Classic.

**Example output**

```json
{
  "data": [
    {
      "created_at": "2013-02-21T10:12:00",
      "id": 1234,
      "name": "Sales Category",
      "sort_order": 1,
      "updated_at": "2013-02-21T10:12:00"
    }
  ]
}
```

### List frequencies

List how often data can be entered against a KPI, such as daily or weekly.

**Inputs**: None.

**Outputs**

- `data` (list): The response from SimpleKPI Classic.

**Example output**

```json
{
  "data": [
    {
      "id": "D",
      "name": "Daily"
    }
  ]
}
```

### List group items

List the items in a group, such as each office.

**Inputs**

- Group (`group_id`, number, required): The group whose items to list.

**Outputs**

- `data` (list): The response from SimpleKPI Classic.

**Example output**

```json
{
  "data": [
    {
      "created_at": "2012-11-30T10:41:00",
      "group_id": 1,
      "id": 2263,
      "name": "Sales",
      "sort_order": 1,
      "updated_at": "2012-11-30T10:41:00"
    }
  ]
}
```

### List groups

List the groups, such as offices or teams, that organise users and their data.

**Inputs**: None.

**Outputs**

- `data` (list): The response from SimpleKPI Classic.

**Example output**

```json
{
  "data": [
    {
      "created_at": "2012-11-30T10:40:00",
      "id": 1,
      "name": "Offices",
      "sort_order": 1,
      "updated_at": "2012-11-30T10:40:00"
    }
  ]
}
```

### List icons

List the icons a KPI can be given.

**Inputs**: None.

**Outputs**

- `data` (list): The response from SimpleKPI Classic.

**Example output**

```json
{
  "data": [
    {
      "id": 5,
      "name": "Calculator"
    }
  ]
}
```

### List KPI entries

List the values users have entered against KPIs, by date.

**Inputs**

- KPI (`kpiid`, number): Only entries for this KPI.
- User (`userid`, number): Only entries for this user.
- From (`dateFrom`, date): Only entries on or after this date. SimpleKPI uses today if left empty.
- To (`dateTo`, date): Only entries on or before this date. SimpleKPI uses today if left empty.
- Page size (`rows`, number): How many entries a page holds, up to 500. From 1 to 500.
- Page (`page`, number): Which page to read, counting from 1. At least 1.

**Outputs**

- `data` (list): The response from SimpleKPI Classic.

**Example output**

```json
{
  "data": [
    {
      "actual": 50,
      "created_at": "2012-11-30T11:20:00",
      "entry_date": "2012-06-25",
      "id": 12345,
      "kpi_id": 5678,
      "notes": "This is a note",
      "target": 110,
      "updated_at": "2013-02-15T16:01:00",
      "user_id": 1234
    }
  ]
}
```

### List KPIs

List the KPIs on your account.

**Inputs**: None.

**Outputs**

- `data` (list): The response from SimpleKPI Classic.

**Example output**

```json
{
  "data": [
    {
      "aggregate_function": "SUM",
      "category_id": 5478,
      "created_at": "2013-02-21T10:57:00",
      "description": "This is the description",
      "frequency_id": "W",
      "icon_id": 1,
      "id": 1234,
      "is_active": true,
      "is_calculated": false,
      "name": "Sales KPI",
      "sort_order": 1,
      "target_default": 100,
      "unit_id": 123,
      "updated_at": "2013-02-21T10:58:00",
      "value_direction": "N"
    }
  ]
}
```

### List KPIs in category

List the KPIs in one category.

**Inputs**

- Category (`category_id`, number, required): The category to list.

**Outputs**

- `data` (list): The response from SimpleKPI Classic.

**Example output**

```json
{
  "data": [
    {
      "aggregate_function": "SUM",
      "category_id": 5478,
      "created_at": "2013-02-21T10:57:00",
      "description": "This is the description",
      "frequency_id": "W",
      "icon_id": 1,
      "id": 1234,
      "is_active": true,
      "is_calculated": false,
      "name": "Sales KPI",
      "sort_order": 1,
      "target_default": 100,
      "unit_id": 123,
      "updated_at": "2013-02-21T10:58:00",
      "value_direction": "N"
    }
  ]
}
```

### List units

List the units that set how KPI values are shown.

**Inputs**: None.

**Outputs**

- `data` (list): The response from SimpleKPI Classic.

**Example output**

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

### List user's KPIs

List the KPIs assigned to a user.

**Inputs**

- User (`user`, number, required): The user whose KPIs to list.

**Outputs**

- `data` (list): The response from SimpleKPI Classic.

**Example output**

```json
{
  "data": [
    {
      "created_at": "2012-11-15T17:03:00",
      "id": 1234,
      "sort_order": 1,
      "updated_at": "2012-11-15T17:03:00",
      "user_id": 5678,
      "user_target": 123
    }
  ]
}
```

### List users

List the people on your account.

**Inputs**: None.

**Outputs**

- `data` (list): The response from SimpleKPI Classic.

**Example output**

```json
{
  "data": [
    {
      "can_admin_settings": false,
      "can_manage_users": true,
      "created_at": "2012-09-10T14:35:00",
      "email": "jim@simplekpi.com",
      "first_name": "Jim",
      "id": 1234,
      "last_login_at": "2012-11-10T14:35:00",
      "last_name": "Jones",
      "last_password_changed_at": "2012-12-10T14:35:00",
      "updated_at": "2012-11-30T11:01:00",
      "user_status_id": "A",
      "user_type": "Manager"
    }
  ]
}
```

### Unassign KPI from user

Stop a user entering data against a KPI.

**Inputs**

- User (`user`, number, required): The user to take the KPI from.
- KPI (`id`, number, required): The KPI to unassign.

**Outputs**

- `data` (object): The response from SimpleKPI Classic.

**Example output**

```json
{
  "data": {}
}
```

### Update KPI

Change a KPI's settings. Calculated KPIs can only be changed in SimpleKPI.

**Inputs**

- KPI (`id`, number, required): The KPI to change.
- Category (`category_id`, number, required): The category the KPI goes in.
- Name (`name`, text, required): What the KPI is called, up to 100 characters.
- Frequency (`frequency_id`, text, required): How often data is entered against it.
- Icon (`icon_id`, number, required): The icon shown with the KPI.
- Unit (`unit_id`, number, required): How its values are shown.
- Good direction (`value_direction`, text, required): Which way the KPI has to move to be doing well. One of: `U` (Up is good), `D` (Down is good), `N` (Neither).
- Roll-up (`aggregate_function`, text, required): How its values are totalled. One of: `SUM` (Total (sum)), `AVG` (Average).
- Position (`sort_order`, number, required): Where the KPI sits in the list.
- Active (`is_active`, true/false, required): Turn on so data can be entered against it; off makes it display only.
- Description (`description`, text): Text shown with the KPI, up to 150 characters.
- Default target (`target_default`, number): The default target. Leave empty for a KPI with no target.

**Outputs**

- `data` (object): The response from SimpleKPI Classic.

**Example output**

```json
{
  "data": {
    "aggregate_function": "SUM",
    "category_id": 5478,
    "created_at": "2013-02-21T10:57:00",
    "description": "This is the description",
    "frequency_id": "W",
    "icon_id": 1,
    "id": 1234,
    "is_active": true,
    "is_calculated": false,
    "name": "Sales KPI",
    "sort_order": 1,
    "target_default": 100,
    "unit_id": 123,
    "updated_at": "2013-02-21T10:58:00",
    "value_direction": "N"
  }
}
```

### Update KPI entry

Change one KPI entry.

**Inputs**

- Entry ID (`id`, number, required): The entry to change, from List KPI entries.
- User (`user`, number, required): The user the entry belongs to.
- KPI (`kpi_id`, number, required): The KPI the entry belongs to.
- Date (`entry_date`, date, required): The date the value is for.
- Actual (`actual`, number): The actual value.
- Target (`target`, number): The target. Ignored when the KPI has no target.
- Notes (`notes`, text): A note for the entry, up to 500 characters.

**Outputs**

- `data` (object): The response from SimpleKPI Classic.

**Example output**

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