# Objectives

### The Objective Object

| Attribute             | Type             | Description                                                                              |
| --------------------- | ---------------- | ---------------------------------------------------------------------------------------- |
| id                    | string           | Unique objective identifier                                                              |
| name                  | string           | Name of the objective                                                                    |
| created\_at           | string           | Time when the objective was created. RFC 3339 format                                     |
| modified\_at          | string           | Time when the objective was last updated. RFC 3339 format                                |
| team\_id              | string, nullable | Unique team identifier. Indicates the team assigned to the objective                     |
| assignee\_id          | string, nullable | Unique user identifier. Indicates the user assigned to the objective                     |
| description           | string, nullable | Description of the objective                                                             |
| is\_personal          | bool             | Flag indicating whether this is a personal objective                                     |
| is\_company           | bool             | Flag indicating whether this is a company objective                                      |
| parent\_objective\_id | string, nullable | Unique objective identifier. Indicates objective alignment                               |
| cycle\_id             | string           | Unique delivery cycle identifier. Indicates the delivery cycle this objective belongs to |

Example:

```javascript
{
  "id": "16682617-f25d-4df2-9f51-3c38298996b8",
  "name": "Become best at OKRs",
  "created_at": "2018-02-20T12:32:56Z",
  "modified_at": "2018-02-20T12:32:56Z",
  "team_id": null,
  "assignee_id": null,
  "description": null,
  "is_personal": false,
  "is_company": true,
  "parent_objective_id": null,
  "cycle_id": "12345678-f25d-4df2-9f51-3c38298996b8"
}
```

## Create Objective

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

Create a new Objective.

#### Request Body

| Name                  | Type    | Description                                            |
| --------------------- | ------- | ------------------------------------------------------ |
| parent\_objective\_id | string  | Existing Objective ID. Indicates parent objective.     |
| cycle\_id             | string  | Cycle ID.                                              |
| is\_company           | boolean | When true, mark objective as company objective.        |
| is\_personal          | boolean | When true, mark objective as personal objective.       |
| description           | string  | Short objective description.                           |
| assignee\_id          | string  | User ID. Indicates the user assigned to the objective. |
| team\_id              | string  | Team ID. Indicates the team assigned to the objective. |
| name                  | string  | Name of the objective.                                 |

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

```javascript
{
  "id": "16682617-f25d-4df2-9f51-3c38298996b8",
  "name": "Become best at OKRs",
  "created_at": "2018-02-20T12:32:56Z",
  "modified_at": "2018-02-20T12:32:56Z",
  "team_id": null,
  "assignee_id": null,
  "description": null,
  "is_personal": false,
  "is_company": true,
  "parent_objective_id": null,
  "cycle_id": "12345678-f25d-4df2-9f51-3c38298996b8"
}
```

{% endtab %}
{% endtabs %}

## Update Objective

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

Update an existing new Objective.

#### Path Parameters

| Name | Type   | Description                                  |
| ---- | ------ | -------------------------------------------- |
| id   | string | ID of the objective that you want to update. |

#### Request Body

| Name                  | Type    | Description                                            |
| --------------------- | ------- | ------------------------------------------------------ |
| parent\_objective\_id | string  | Existing Objective ID. Indicates parent objective.     |
| cycle\_id             | string  | Cycle ID.                                              |
| is\_company           | boolean | When true, mark objective as company objective.        |
| is\_personal          | boolean | When true, mark objective as personal objective.       |
| description           | string  | Short objective description.                           |
| assignee\_id          | string  | User ID. Indicates the user assigned to the objective. |
| team\_id              | string  | Team ID. Indicates the team assigned to the objective. |
| name                  | string  | Name of the objective.                                 |

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

```javascript
{
  "id": "16682617-f25d-4df2-9f51-3c38298996b8",
  "name": "Become best at OKRs",
  "created_at": "2018-02-20T12:32:56Z",
  "modified_at": "2018-02-20T12:32:56Z",
  "team_id": null,
  "assignee_id": null,
  "description": null,
  "is_personal": false,
  "is_company": true,
  "parent_objective_id": null,
  "cycle_id": "12345678-f25d-4df2-9f51-3c38298996b8"
}
```

{% endtab %}
{% endtabs %}

## List Objectives

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

Returns a list of available objectives.

#### Query Parameters

| Name        | Type   | Description                             |
| ----------- | ------ | --------------------------------------- |
| page\_token | string | Page identifier                         |
| cycle\_id   | string | Cycle ID for which to return Objectives |

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

```javascript
{
  "next_page_token": null,
  "objectives": [
    {
      "name": "Become best at OKRs",
      "cycle_id": "12345678-f25d-4df2-9f51-3c38298996b8",
      "description": null,
      "team_id": null,
      "assignee_id": null,
      "parent_objective_id": null,
      "is_company": true,
      "is_personal": false
    },
    {...},
    {...}
  ]
}
```

{% endtab %}
{% endtabs %}

## Retrieve Objective

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

Retrieve details about the existing objective.

#### Path Parameters

| Name | Type   | Description  |
| ---- | ------ | ------------ |
| id   | string | Objective ID |

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

```javascript
{
  "id": "16682617-f25d-4df2-9f51-3c38298996b8",
  "name": "Become best at OKRs",
  "created_at": "2018-02-20T12:32:56Z",
  "modified_at": "2018-02-20T12:32:56Z",
  "team_id": null,
  "assignee_id": null,
  "description": null,
  "is_personal": false,
  "is_company": true,
  "parent_objective_id": null,
  "cycle_id": "12345678-f25d-4df2-9f51-3c38298996b8"
}
```

{% endtab %}
{% endtabs %}

## Delete Objective

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

Delete an existing Objective and all data associated with it.

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

```
```

{% endtab %}
{% endtabs %}

## List Key Results

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

List Key Results for an existing objective.

#### Path Parameters

| Name | Type   | Description  |
| ---- | ------ | ------------ |
| id   | string | Objective ID |

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

```
```

{% endtab %}
{% endtabs %}

## Create Key Result

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

Add a new Key Result to an existing Objective

#### Path Parameters

| Name | Type   | Description  |
| ---- | ------ | ------------ |
| id   | string | Objective ID |

#### Request Body

| Name               | Type   | Description                                 |
| ------------------ | ------ | ------------------------------------------- |
| confidence         | string | Decimal string value between 0 and 1.       |
| target\_value\_max | string | Maximum target value where applicable.      |
| target\_value\_min | string | Minimum target value where applicable.      |
| current\_value     | string | Decimal string representing starting value. |
| 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 %}
