Skip to main content

Update counters via API

Overview

The Counters API provides endpoints for managing running hours (counters) within the MXSuite system. This API allows you to upload counter history records for one or more counters at a location, with proper authorization controls.

Base URL

  • api/external/Counters/

1. Upload Counters History

Overview

The Upload Counters History endpoint allows authorized users to upload a batch of running hours (counter) history records for one or more counters at a specific location. This is typically used to record the latest readings for equipment counters.

Endpoint

POST /api/external/Counters/UploadCountersHistory

Authentication

All endpoints require authentication and appropriate user rights.
This endpoint requires the UpdateRunningHours right and the location must not be read-only.
Authorization is enforced via the MXApiPolicyAuthorize attribute.

Request
{
  name: string,
  locationName: string,
  value: number,
  timeStamp: Date
}
[
  {
    "Name": "Main Engine",
    "LocationName": "Neptune",
    "Value": 12345,
    "TimeStamp": "2025-06-23T14:00:00Z"
  },
  {
    "Name": "Generator 1",
    "LocationName": "Neptune",
    "Value": 6789,
    "TimeStamp": "2025-06-23T14:00:00Z"
  }
]
Error Responses

•    400 Bad Request: Invalid input data (e.g., missing required fields, invalid values).
•    401 Unauthorized: User is not authenticated.
•    403 Forbidden: User does not have the required rights or location is read-only.
•    500 Internal Server Error: An unexpected error occurred.

If there is no location with that name, the entry is ignored.
If there is no counter with that name for that location, the entry is ignored.
If there is already an entry added for that counter in that location with the same value and timestamp, the entry is ignored.