π Managing KPIs via REST API
This article explains how to record, update, and manage Key Performance Indicators (KPIs) via the ValueStreamer REST API in an automated way. It is intended for developers and IT administrators who need to regularly transfer KPI data from third-party systems (e.g., ERP, MES, BI) into ValueStreamer.
π Contents
-
Prerequisites
-
Authentication
-
Overview of Endpoints
-
Create or Update a Dataset (PUT)
-
Retrieve Datasets (GET)
-
Delete Datasets (DELETE)
-
Technical Notes
-
Tips & Best Practices
-
FAQ
π Prerequisites
-
π API credentials (Username + Password for HTTP Basic Auth)
-
π Access to an execution environment (e.g., Power Automate, Python, Postman, Swagger UI, or your own integration solution)
-
π§Ύ UUIDs for KPI, Team, and optional Sub-Tile/KPI value (can be retrieved via meta-endpoints)
π Authentication
Authentication is done via HTTP Basic Auth.
Header example:
Authorization: Basic <Base64-encoded username:password>
βΉοΈ Note: Access is only possible for users with the appropriate API permission.
π Overview of Endpoints (KPI)
Method | Endpoint | Description |
---|---|---|
GET | /exchange/kpi-data |
Retrieve a list of all KPI data |
GET | /exchange/kpi-data/{date}/{team-id}/{kpi-id} |
Retrieve a single dataset |
PUT | /exchange/kpi-data/{date}/{team-id}/{kpi-id} |
Create or update a KPI dataset |
DELETE | /exchange/kpi-data/{date}/{team-id}/{kpi-id} |
Delete a KPI dataset |
πΈ Screenshot: API Endpoints Overview in Swagger UI
π₯ Creating or Updating a KPI Dataset (PUT)
Example request:
PUT /exchange/kpi-data/2022-11-01/8dca904d-9134-3bb0-95b7-3f72ae3dfacf/c3ba32c2-a13a-0000-0000-000000000000
πΈ Screenshot: Swagger UI β PUT request for KPI data
Headers:
Content-Type: application/vs.v2.0+json
Authorization: Basic <Base64 credentials>
Body example:
{
"values": [
{
"kpiValueId": "79cf2f74-0e9c-45b5-bc4d-f437079dde7c",
"value": 177
},
{
"kpiValueId": "fd2c7750-79e1-4514-89a2-e9c103db4d6b",
"value": 190
}
]
}
β¨ Tip: You can also send only specific values (e.g., just "target"
) β the API will intelligently add or update existing values.
π Retrieving KPI Datasets (GET)
Example: Retrieve all values for a KPI within a date range:
GET /exchange/kpi-data?kpi-id={kpi-id}&team-id={team-id}&from=2022-10-01&to=2022-10-31
πΈ Screenshot: Swagger UI β GET request with filter parameters
βΉοΈ Note:
-
Maximum range: 31 days (daily entries)
-
Or 6 months (weekly/monthly entries)
β Deleting a KPI Dataset (DELETE)
DELETE /exchange/kpi-data/2022-11-01/8dca904d-9134-3bb0-95b7-3f72ae3dfacf/c3ba32c2-a13a-0000-0000-000000000000
β οΈ Warning: Deleted entries cannot be restored.
π Technical Notes
-
Each KPI value is uniquely identified by: date + team + kpi (+ sub-tile)
-
The API accepts only one dataset per day/KPI/team/sub-tile
-
Date format:
yyyy-MM-dd
(also applies to weekly/monthly entries)-
Week: Date of the Monday
-
Month: Date of the 1st day
-
-
Sub-tiles are optional but required for more granular structuring
β¨ Tips & Best Practices
-
π§ͺ Start with tests in Swagger Editor or Postman
-
π Update KPI values regularly for consistent analytics
-
π§© Enter values only at the lowest team level β aggregation happens automatically
-
π§Ύ Verify UUIDs for KPI, Team, Sub-Tile, KPI value via meta-endpoints
β FAQ
How do I find the required UUIDs (KPI, Team, KPI values)?
π Use the meta-endpoints /exchange/kpi
and /exchange/kpi/{kpi-id}
.
What happens if I send the same values again?
π The API detects existing combinations and overwrites them (PUT = Create/Update).
Can I send only target values?
π No β if target values are missing, the API may set them to default (0) or use historical targets.