Objectives

Base Path: `/v1/objectives

Create Objective

Method: POST Endpoint: https://api.tokensource.com/v1/objectives Description: Creates a new objective.

Request Body:

{
  "name": "New Objective",
  "description": "Description of the objective",
  "status": "on_track",
  "metrics": [
    { "key": "metric1", "value": "value1" },
    { "key": "metric2", "value": "value2" }
  ]
}

Response (201 Created):

{
  "message": "Objective created",
  "objective": {
    "id": 1,
    "externalId": "generated-external-id",
    "name": "New Objective",
    "description": "Description of the objective",
    "status": "on_track",
    "userId": 1,
    "createdAt": "2023-10-27T13:00:00Z",
    "updatedAt": "2023-10-27T13:00:00Z",
    "metrics": [
      {
        "id": 1,
        "objectiveId": 1,
        "value": "{\"key\":\"metric1\",\"value\":\"value1\"}",
        "createdAt": "2023-10-27T13:00:00Z"
      }
    ],
    "aiAssistants": []
  }
}

Get All Objectives

Method: GET Endpoint: https://api.tokensource.com/v1/objectives Description: Retrieves all objectives.

Response (200 OK):

Get Objective by ID

Method: GET Endpoint: https://api.tokensource.com/v1/objectives/{id} Description: Retrieves a specific objective by its external ID.

Parameters:

  • id (string, required)

Response (200 OK):

Response (404 Not Found):

Update Objective

Method: PUT Endpoint: https://api.tokensource.com/v1/objectives/{id} Description: Updates an existing objective.

Parameters:

  • id (integer, required)

Request Body:

Response (200 OK):

Delete Objective

Method: DELETE Endpoint: https://api.tokensource.com/v1/objectives/{id} Description: Deletes an objective.

Parameters:

  • id (integer, required)

Response (200 OK):

`

Last updated