Maintenance
Items
- GET /api/maintenance/items/
List all existing maintenance items.
- Query Parameters:
item_type (string) – get only items of a certain type
machine_id (int) – limit results to issues with this machine. Use
0to get issues with no machine assigned. Can be provided multiple times to include issues from multiple machines.equipment_id (int) – limit results to issues with this equipment. Use
0to get issues with no equipment assigned. Can be provided multiple times to include issues from multiple pieces of equipment.
- Returns:
a map of
MaintenanceItemID toMaintenanceItemobject
- GET /api/maintenance/items/(int: item_id)
Get details about a single maintenance item.
- Parameters:
item_id – the ID of the item to get details for
- Status Codes:
404 Not Found – if the item ID is invalid
- Returns:
a
MaintenanceItemobject
- PUT /api/maintenance/items/
Create a new maintenance item.
- Reqjson:
a
MaintenanceItemobject with at least the following fields: -item_type: one ofmeasurement,task-name: name for the item- Status Codes:
400 Bad Request – if a required field is missing or invalid
201 Created – on success
- Returns:
the newly created
MaintenanceItemobject
- PATCH /api/maintenance/items/(int: item_id)
Edit an existing maintenance item.
- Reqjson:
a (partial)
MaintenanceItemobject. It is not possible to change an item’s type, so theitem_typefield will be ignored.- Status Codes:
400 Bad Request – if the item properties are invalid
404 Not Found – if the item ID is not valid
- Returns:
the modified
MaintenanceItemobject
- DELETE /api/maintenance/items/(int: item_id)
Delete an existing maintenance item.
- Status Codes:
404 Not Found – if the item ID is not valid
204 No Content – on success
- GET /api/maintenance/items/(int: item_id)/entries
Get a maintenance item’s entries.
Use
limitandoffsetto get only recent entries (results are queried newest to oldest, but the returned object is unordered).- Parameters:
item_id – the ID of the maintenance item to get entries for
- Query Parameters:
limit (int) – limit the number of entries returned
offset (int) – skip this many entries
- Status Codes:
404 Not Found – if the item ID is invalid
- Returns:
a map of
MaintenanceEntryID toMaintenanceEntryobject
- GET /api/maintenance/items/schedule
Get recurrence timestamps of all maintenance items in a selected date range.
- Query Parameters:
start (int) – start of time range (UNIX timestamp)
end (int) – end of time range (UNIX timestamp)
- Status Codes:
400 Bad Request – if start and/or end are missing
- Returns:
an object mapping maintenance item ID to a list of due dates (UNIX timestamps)
- POST /api/maintenance/items/previewSchedule
List the next few times when the provided schedule would run. The request body should include at least the scheduling fields of a maintenance item, but the
idandinitial_entryfields are also used if provided:If
idis set, the schedule will start from the timestamp of the last maintenance entry with that item ID, falling back to theinitial_entryfield otherwise. If neither field is set, the schedule will start from the current date in the local time zone.- Query Parameters:
count (int) – how many future times to get (defaults to 1)
- Reqjson:
a partial MaintenanceItem object
- Returns:
an array of
countUNIX timestamps
- POST /api/maintenance/items/averageCompletionDurations
Calculates the average of the
durationvalues for successful completions of a maintenance item.Example request body[42, 43, 44, 45]
Example response body for the above example request, where maintenance item 44 has never been completed successfully and 45 doesn’t exist.{"42": 18.4, "43": 26.1, "44": null}
- Reqjsonarr:
IDs of the maintenance item to analyze. Invalid item IDs will be ignored.
- Returns:
an object mapping each maintenance item ID to a floating point number of minutes, which will be
nullfor maintenance items that have never been completed successfully.- Status Codes:
400 Bad Request – if the JSON request body is invalid.
- GET /api/maintenance/items/import
Get a copy of the maintenance item import template that can be filled in to bulk import maintenance items.
- Returns:
an XLTX file
- POST /api/maintenance/items/import
Upload a filled-in copy of the maintenance item import template.
The request body should be the binary file.
- Query Parameters:
machine (int) – if provided, maintenance items created during this import will be assigned to the machine with this ID.
- Status Codes:
201 Created – on success
404 Not Found – if an invalid machine ID is provided
422 Unprocessable Entity – if the workbook is invalid for any reason
- Resjsonobj:
maps maintenance item ID to new maintenance item object
Entries
- PUT /api/maintenance/entries/
Create a new maintenance entry.
- Reqjson:
a
MaintenanceEntryobject- Request JSON Object:
entry_type (string) – one of
measurement,task(required)item_id (int) – ID of the item this entry is for (required)
- Status Codes:
400 Bad Request – if a required field is missing or invalid
201 Created – on success
- Returns:
the newly created
MaintenanceEntryobject
- PATCH /api/maintenance/entries/(int: entry_id)
Edit an existing maintenance entry.
- Reqjson:
a (partial)
MaintenanceEntryobject. It is not possible to change an entry’s type, so theentry_typefield will be ignored.- Status Codes:
404 Not Found – if the entry ID is not valid
- Returns:
the modified
MaintenanceEntryobject
- DELETE /api/maintenance/entries/(int: entry_id)
Delete an existing maintenance entry.
- Status Codes:
404 Not Found – if the entry ID is not valid
204 No Content – on success