# Key Results

### The Key Result Object

| Attribute          | Type             | Description                                                                      |
| ------------------ | ---------------- | -------------------------------------------------------------------------------- |
| id                 | string           | Unique key result identifier.                                                    |
| name               | string           | Name of the key result.                                                          |
| created\_at        | string           | Time when the key result was created. RFC 3339 format.                           |
| modified\_at       | string           | Time when the key result was last updated. RFC 3339 format.                      |
| objective\_id      | string           | Objective identifier.                                                            |
| confidence         | string           | Decimal string between 0.0 and 1.0 indicating confidence of reaching the target. |
| type               | string           | Metric type. One of `milestone`, `baseline`, `range`, `positive`, `negative`.    |
| current\_value     | string           | Decimal. Current metric value.                                                   |
| target\_value\_min | string, nullable | Decimal. Minimum target value.                                                   |
| target\_value\_max | string, nullable | Decimal. Maximum target value.                                                   |

Target values are optional for some metric types.

* `postive` and `negative` metrics will have only `target_value_min` set.
* `range` metrics will have both `target_value_min` and `target_value_max` set.
* `baseline` will not have either of the target values set.
* `milestone` will always have `target_value_min` set to `1.00`.

Example:

```javascript
{
  "id": "16682617-f25d-4df2-9f51-3c38298996b8",
  "name": "$40K in revenue from subscription sales",
  "created_at": "2018-02-20T12:32:56Z",
  "modified_at": "2018-02-20T12:32:56Z",
  "objective_id": "12345678-f25d-4df2-9f51-3c38298996b8",
  "type": "positive",
  "confidence": "0.50",
  "current_value": "10000.00",
  "target_value_min": "40000.00",
  "target_value_max": null
}
```

## List Key Results

<mark style="color:blue;">`GET`</mark> `https://api.simpleokr.com/v1/keyresults`

Returns a list of your Key Results.

#### Query Parameters

| Name        | Type   | Description     |
| ----------- | ------ | --------------- |
| page\_token | string | Page identifier |
| cycle\_id   | string | Cycle ID        |

{% tabs %}
{% tab title="200 " %}

```javascript
{
  "next_page_token": null,
  "keyresults": [
    {
      "id": "16682617-f25d-4df2-9f51-3c38298996b8",
      "name": "$40K in revenue from subscription sales",
      "created_at": "2018-02-20T12:32:56Z",
      "modified_at": "2018-02-20T12:32:56Z",
      "objective_id": "12345678-f25d-4df2-9f51-3c38298996b8",
      "type": "positive",
      "confidence": "0.50",
      "current_value": "10000.00",
      "target_value_min": "40000.00",
      "target_value_max": null
    },
    {...},
    {...}
  ]
}
```

{% endtab %}
{% endtabs %}

## Retrieve Key Result

<mark style="color:blue;">`GET`</mark> `https://api.simpleokr.com/v1/keyresults/:id`

Retrieve an existing Key Result.

#### Path Parameters

| Name | Type   | Description   |
| ---- | ------ | ------------- |
| id   | string | Key Result ID |

{% tabs %}
{% tab title="200 " %}

```javascript
{
  "id": "16682617-f25d-4df2-9f51-3c38298996b8",
  "name": "$40K in revenue from subscription sales",
  "created_at": "2018-02-20T12:32:56Z",
  "modified_at": "2018-02-20T12:32:56Z",
  "objective_id": "12345678-f25d-4df2-9f51-3c38298996b8",
  "type": "positive",
  "confidence": "0.50",
  "current_value": "10000.00",
  "target_value_min": "40000.00",
  "target_value_max": null
}
```

{% endtab %}
{% endtabs %}

## Update Key Result

<mark style="color:green;">`POST`</mark> `https://api.simpleokr.com/v1/keyresults/:id`

#### Path Parameters

| Name | Type   | Description   |
| ---- | ------ | ------------- |
| id   | string | Key Result ID |

#### Request Body

| Name               | Type   | Description                                         |
| ------------------ | ------ | --------------------------------------------------- |
| target\_value\_max | string | Maximum  target value where applicable.             |
| target\_value\_min | string | Minimum target value where applicable.              |
| objective\_id      | string | Objective ID.                                       |
| current\_value     | string | A decimal string representing current value.        |
| confidence         | string | Confidence. A decimal string value between 0 and 1. |
| type               | string | Key Result type.                                    |
| name               | string | Key Result name.                                    |

{% tabs %}
{% tab title="200 " %}

```javascript
{
  "id": "16682617-f25d-4df2-9f51-3c38298996b8",
  "name": "$40K in revenue from subscription sales",
  "created_at": "2018-02-20T12:32:56Z",
  "modified_at": "2018-02-20T12:32:56Z",
  "objective_id": "12345678-f25d-4df2-9f51-3c38298996b8",
  "type": "positive",
  "confidence": "0.50",
  "current_value": "10000.00",
  "target_value_min": "40000.00",
  "target_value_max": null
}
```

{% endtab %}
{% endtabs %}

## Delete Key Result

<mark style="color:red;">`DELETE`</mark> `https://api.simpleokr.com/v1/keyresults/:id`

Deletes and existing Key Result.

#### Path Parameters

| Name | Type   | Description   |
| ---- | ------ | ------------- |
| id   | string | Key Result ID |

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}
