Kpi_Get (Get)
- Last UpdatedNov 06, 2025
- 2 minute read
| Get | Kpi_Get |
Resource Path:/api/kpi
| Name | Description | Data Type |
|---|---|---|
| entId | Required. The entity ID (entId) or the line ID (lineId). | integer |
| quality | For entity KPI only: An indication whether to get quality data. | boolean |
| performance | For entity KPI only: An indication whether to get performance data. | boolean |
| oee | For entity KPI only: An indication whether to get OEE data. | boolean |
| availability | For entity KPI only: An indication whether to get availability data. | boolean |
| filterType | 0 = Current hour 1 = Last n hours, where n is the number of hours specified by the filterDuration parameter 2 = Current shift 3 = Previous shift 4 = Current day 5 = Yesterday 6 = Current week 7 = Previous week 8 = Current month 9 = Previous month | integer |
| filterDuration | If the filter type is set to 1, last n hours, this is the value for n (that is, the number of hours). If no value is provided, the default value of 1 hour is used. | integer |
The response body is of type Array[Mes.WebApi.Models.Kpi].
Examples: Get KPI Data for an Entity
To get the availability data for the entity with an ID of 7 for the last 2 hours:
api/kpi?entId=7&availability=true&filterType=1&filterDuration=2
Examples: Work Tasks Lookups, Get KPI Data for an Entity
To get the KPI data for an entity within a specified time period and based on whether it is availability data:
api/kpi?entId={entId}&availability={availability}&filterType={filterType}
Examples: Get KPI Data for a Line
To get the KPI data for the line with an ID of 33 for the last 5 hours:
api/kpi?lineId=33&filterType=1&filterDuration=5
To get the KPI data for the line with an ID of 33 for today:
api/kpi?lineId=33&filterType=4
Examples: Work Tasks Lookups, Get KPI Data for a Line
To get the KPI data for a line within a specified time period:
api/kpi?lineId={lineId}&filterType={filterType}
The KPI types are calculated as follows:
OEE = Quality × Availability × Performance
Quality = Sum of Good Quantities ÷ (Sum of Good Quantities + Sum of Reject Quantities)
Availability = Total runtime ÷ (Total runtime + Total downtime)
Performance = CEIL((Total Good Quantities + Total Reject Quantities) ÷ Batch Size) ÷ (Total Runtime ÷ 3600)
Quality is calculated based on the good and reject quantities from the Item_Prod table.
Availability is calculated based on the runtime and downtime durations from the Util_History table.
Performance is calculated based on the quantities in the Item_Prod table and the durations from the Util_History table.