Machines
- GET /api/machines/(int: machine_id)
Get information about a single machine.
- Parameters:
machine_id – the ID of the machine to query
- Returns:
the machine object
- Status Codes:
404 Not Found – if the machine object does not exist
- GET /api/machines/
Get a list of all registered machines.
- Returns:
an object mapping machine IDs to machine objects
- GET /api/machines/systems
Get a list of supported Machine systems.
- Returns:
an object mapping system IDs to system objects
- PUT /api/machines/
Add a new machine with the provided name.
- Request JSON Object:
name (string) – name for the new machine
- Returns:
the new machine object
- Status Codes:
400 Bad Request – if the name is missing
500 Internal Server Error – if there is an error
201 Created – on success
- DELETE /api/machines/(int: machine_id)
Delete a machine from the database.
- Parameters:
machine_id – The numeric ID of the machine to delete.
- Status Codes:
204 No Content – on success
404 Not Found – if the machine does not exist
- GET /api/machines/(int: machine_id)/goals
Get a machine’s production goals.
- Query Parameters:
start (float) – start the chart at this UNIX timestamp. Defaults to the start of the current day in local time.
end (float) – end the chart at this UNIX timestamp. Defaults to the start of the current day in local time.
- Parameters:
machine_id – the ID of the machine to check goals for
- Returns:
an object mapping timestamps to the number of parts that should be produced by that time
- Status Codes:
404 Not Found – if the machine does not exist
- GET /api/machines/(int: machine_id)/chart
Get chart data for a machine.
Note
Goals and feed rate overrides are returned as 2D arrays to reduce data size in transit and in memory. When parsing this response in strongly-typed languages, the timestamps may be truncated to integers to make 2D array allocation easier.
Feature
Properties included in response
nc_alarms
nc_alarms
autocomp
autocomp_data
downtime
downtime
feed_rate
feed_rate_overrides
goals
goals
parts
parts
programs
processes
rapid
rapid_overrides
shifts
shifts
tmac_alarms
tmac_alarms
tools
tools
tool_replacements
upcoming_tool_replacements
utilization
utilization
- Parameters:
machine_id – The ID of the machine to get chart data for
- Query Parameters:
start (float) – start the chart at this UNIX timestamp. Defaults to the start of the current day in local time.
end (float) – end the chart at this UNIX timestamp. Defaults to the start of the current day in local time.
feature (string) – specify a feature to include Using this parameter to request specific features can decrease the request processing time. This parameter can be set multiple times to request multiple features. If it is not specified, all features will be enabled. Allowed values and the response fields they provide are described in the table above.
- Response JSON Object:
machine_id (int)
machine_name (string)
shift – contains
start
andend
timestampsgoals – array of 2-arrays, where each 2-array contains: [0] the UNIX timestamp when this number of parts should be completed (float), and [1] the number of parts that should be completed (int)
parts – maps part IDs to part objects
nc_alarms – maps NC alarm ID to Alarm object
tmac_alarms – maps TMAC alarm ID to Alarm object
tool_replacements – tool replacements indexed by tool ID
upcoming_tool_replacements – map of tool ID to predicted timestamp of next replacement due
autocomp_data – AutoComp data indexed by program
feed_rate_overrides – array of 2-arrays, where each 2-array contains: [0] the UNIX timestamp the feed rate was recorded and (float), and [1] the value recorded (int)
- Status Codes:
404 Not Found – if the machine does not exist
- PATCH /api/machines/(int: machine_id)
Save machine settings.
Note
Some settings require administrator privileges to change, while others can be changed with planner privileges. Errors will be silently ignored.
Setting
Admin
Planner
name
X
description
X
system
X
custom_alarms
X
nc_properties
X
tmac_url
X
tmac_api_key
X
tmac_instance_name
X
autocomp_support
X
time_study
X
notify_channel
X
alarm_notification_grouping
X
notify_nc_alarms
X
X
notify_tmac_alarms
X
X
notify_feed_hold
X
X
notify_end_shift
X
X
notify_production_behind
X
X
notify_goal_met
X
X
notify_production_stopped
X
X
inventory_point_id
X
X
- Parameters:
machine_id – The numeric ID of the machine to save settings for
- Returns:
the modified machine object
- Status Codes:
404 Not Found – if the machine does not exist
- GET /api/machines/(int: machine_id)/overview/(int: year)
- GET /api/machines/(int: machine_id)/overview/(int: year)/(int: month)
Get a day-level overview of a machine’s production history.
- Parameters:
machine_id – The ID of the machine to query
year – the year to get parts from
month – the month to get parts from (1..12). If omitted, the entire year will be returned.
- Returns:
a JSON object mapping dates in “YYYY-MM-DD” format to arrays with: - [0] the number of parts produced - [1] the average cycle time Days with no parts produced will not be included.
- Status Codes:
404 Not Found – if the machine does not exist
- GET /api/machines/tags
Get all known machine tags and their colors.
Tool tag colors can be customized by setting the
machine_tag_colors
option.- Returns:
an object with tags as keys and colors as values
- GET /api/machines/(int: machine_id)/oee
Get OEE history for a machine, sorted with the most recent calculations first.
- Query Parameters:
collapse – set to “day” to get only the last calculation per day or leave the default “all” to get every stored calculation
limit (int) – limit the number of results returned
offset (int) – skip past this many results
- Status Codes:
404 Not Found – if the machine does not exist
400 Bad Request – if the interval is incorrect
- POST /api/machines/(int: machine_id)/update/(src)
Manually update the machine state without involving the proxy.
This endpoint only accepts the Machine update format in the request body.
- Parameters:
machine_id – the ID of the machine to update
src – “nc” or “tmac”
- Status Codes:
404 Not Found – if the machine does not exist
412 Precondition Failed – if the data source is invalid
- GET /api/machines/(int: machine_id)/stateHistory
Get the history of a machine’s cycle state.
- Query Parameters:
start (float) – only state history records on or after this time (UNIX timestamp) will be returned
end (float) – only state history records on or before this time (UNIX timestamp) will be returned
- Status Codes:
404 Not Found – if the machine does not exist
- Returns:
an array of MachineStateRecord objects in chronological order
- GET /api/machines/(int: machine_id)/holds
Get past and/or present holds on the specified machine.
- Parameters:
machine_id – the ID of the machine to get holds for
- Query Parameters:
limit (int) – limit the number of results returned
offset (int) – skip this many entries
- Returns:
a list of MachineHold objects in chronological order by start date and time
- Status Codes:
201 Created – on success
404 Not Found – if the machine does not exist
- PUT /api/machines/(int: machine_id)/holds
Create a new hold on the specified machine.
- Parameters:
machine_id – the ID of the machine to hold
- Reqjson:
a MachineHold object
- Returns:
the new MachineHold object
- Status Codes:
201 Created – on success
404 Not Found – if the machine does not exist