Metrics API
This API allows managing metrics in the system. It provides endpoints to create, read, update, and delete metrics, as well as to perform queries and filtering on them.
The Metric Object
The Metric object represents a metric in the system.
Attributes
| Attribute | Description | Type |
|---|---|---|
| id | Unique identifier of the metric | String |
| borrowerId | Associated borrower ID (optional) | String |
| key | Unique key of the metric | String |
| label | Descriptive label of the metric | String |
| value | Current value of the metric | Any |
| dataType | Data type of the metric (string, number) | String |
| history | History of metric values | Array of Object |
| tags | Tags associated with the metric | Array of String |
| createdAt | Creation date and time of the metric | String (ISO 8601) |
| updatedAt | Date and time of the last update | String (ISO 8601) |
Available Operations
Create a New Metric
Creates a new metric in the system.
Input Parameters:
| Parameter | Description | Type | Required |
|---|---|---|---|
| borrowerId | Associated borrower ID | String | No |
| referenceId | Reference ID | String | No |
| executionId | Execution ID | String | No |
| key | Unique key of the metric | String | Yes |
| value | Value of the metric | String | Yes |
| dataType | Data type of the metric | String | No |
| tags | Tags associated with the metric | Array of String | No |
Request Example:
Successful Response:
Update an Existing Metric
Updates an existing metric in the system.
Path Parameters:
| Parameter | Description |
|---|---|
| metric_id | ID of the metric |
Input Parameters:
| Parameter | Description | Type | Required |
|---|---|---|---|
| borrowerId | Associated borrower ID | String | No |
| referenceId | Reference ID | String | No |
| executionId | Execution ID | String | No |
| value | New value of the metric | String | No |
| date | Date of the update | String | No |
| tags | New tags associated with the metric | Array of String | No |
Request Example:
Successful Response:
Returns the updated Metric object.
Retrieve a Metric
Retrieves information of a specific metric.
Path Parameters:
| Parameter | Description |
|---|---|
| metric_id | ID of the metric |
Successful Response:
Returns the complete Metric object.
Delete a Metric
Deletes a metric from the system.
Path Parameters:
| Parameter | Description |
|---|---|
| metric_id | ID of the metric |
Successful Response:
Status code 204 (No Content) if the deletion was successful.
List Metrics
Retrieves a paginated list of metrics with filtering and sorting options.
Query Parameters:
| Parameter | Description | Type |
|---|---|---|
| borrower-id | Filter by borrower ID | String |
| key | Filter by metric key | String |
| search | Text to search in metrics | String |
| page | Page number (default: 1) | Integer |
| per-page | Items per page (default: 10) | Integer |
| sort-by | Field to sort by | String |
| sort-direction | Sorting direction (asc or desc) | String |
Successful Response:
Paginated list of Metric objects.
Error Handling
The API may return the following error codes:
| Code | Description |
|---|---|
| 400 | Bad Request |
| 401 | Unauthorized |
| 403 | Forbidden |
| 404 | Not Found |
| 409 | Conflict |
| 500 | Internal Server Error |
Errors will include a descriptive message in the response body.