Reports
- GET /api/reports/
Get the available report types.
Example response:
{ "csv": { "description": "Generates a list of links to download CSV files containing data from the OnTakt database.", "params": [], "result_type": "html", "title": "CSV export" }, "event": { "description": "Counts the number of times each NC and TMAC alarm occurred on each machine selected, then calculates the amount of money TMAC saved as defined in cost savings estimation.", "params": [ "machines", "start", "end" ], "result_type": "html", "title": "Events" }, "goal": { "description": "Indicates whether each selected machine is expected to reach its part goal on the current day.", "params": [ "machines" ], "result_type": "html", "title": "Goal Status" }, "kudos": { "description": "Ranks users by how many kudos their notes received during the selected time window.", "params": [ "start", "end" ], "result_type": "html", "title": "Kudos" }, "machine_overview": { "description": "Reports the total number of parts produced and the average cycle time per part for each day of the selected year for each selected machine.", "params": [ "machines", "year" ], "result_type": "html", "title": "Production Overview" }, "machine_runtime": { "description": "Breaks down the total runtime on the machines during the selected time window by process.", "params": [ "machines", "start", "end" ], "result_type": "html", "title": "Machine runtime" }, "margin": { "description": "Returns a Microsoft Excel workbook that includes the number of parts expected, number of parts produced, expected margin, and actual margin per machine for each day in the selected time window, as well as the total margin for the selected interval across all selected machines.", "params": [ "machines", "start", "end", "interval" ], "result_type": "spreadsheet", "title": "Margin Report" }, "part": { "description": "Downloads a Microsoft Excel worksheet with the number of good and scrapped parts broken down by machine and program for each interval in the time range selected.", "params": [ "machines", "start", "end", "interval" ], "result_type": "spreadsheet", "title": "Parts" }, "tool_stock_out": { "description": "How long production can continue based on the stock of each inventory item that is currently in use.", "params": [], "result_type": "html", "title": "Tool Stock Remaining Time" }, "tool_usage": { "description": "Reports the number of replacements expected vs. the number of replacements made for each tool that was replaced on the selected machines during the selected time window.", "params": [ "machines", "start", "end" ], "result_type": "html", "title": "Tool Usage" } }
- Returns:
an object mapping report type IDs to objects, each with:
the
report_type
(same as the key)the
title
anddescription
strings of the reporta
params
array of parameter name stringsa
result_type
of “html” or “spreadsheet”- an array of
tags
that apply to the report (for visual grouping). These tags are currently used: financial
personnel
production
tools
- an array of
- GET /api/reports/(report_type)/run
Run the specified report.
Values for the parameters listed in the report type’s params should be sent in the URL as query parameters for GET requests or in the request body as a JSON object for POST requests (with
Content-Type: application/json
).Errors will be returned as an HTML page for GET requests or as a JSON object for POST requests.
Note
If a
machine_tags
parameter is provided, themachines
parameter becomes optional, and any list provided for themachines
parameter will be expanded to include machines having any of the tags specified in themachine_tags
parameter.- Returns:
an HTML document or Microsoft Excel workbook file. The
Content-Type
andContent-Disposition
response headers can be used to determine the result type.- Status Codes:
404 Not Found – if the report type is unknown
400 Bad Request – if any required parameters are invalid or missing
500 Internal Server Error – if there is an error while generating the report
- POST /api/reports/(report_type)/run
Run the specified report.
Values for the parameters listed in the report type’s params should be sent in the URL as query parameters for GET requests or in the request body as a JSON object for POST requests (with
Content-Type: application/json
).Errors will be returned as an HTML page for GET requests or as a JSON object for POST requests.
Note
If a
machine_tags
parameter is provided, themachines
parameter becomes optional, and any list provided for themachines
parameter will be expanded to include machines having any of the tags specified in themachine_tags
parameter.- Returns:
an HTML document or Microsoft Excel workbook file. The
Content-Type
andContent-Disposition
response headers can be used to determine the result type.- Status Codes:
404 Not Found – if the report type is unknown
400 Bad Request – if any required parameters are invalid or missing
500 Internal Server Error – if there is an error while generating the report
- GET /api/reports/scheduled
Get all existing scheduled reports.
- Returns:
an object mapping scheduled report ID to ScheduledReport object
- POST /api/reports/scheduled/preview
Get the next few times when the provided schedule would run.
- Query Parameters:
count (int) – how many future times to get (defaults to 1)
- Reqjson:
the scheduling fields of a ScheduledReport object
- Returns:
an array of
count
UNIX timestamps
- POST /api/reports/scheduled/(int: scheduled_report_id)/run
Run an existing scheduled report now.
- Status Codes:
404 Not Found – if the specified scheduled report ID is invalid
204 No Content – on success
424 Failed Dependency – if there was an error
- PUT /api/reports/scheduled
Create a new scheduled report.
- Reqjson:
a ScheduledReport object
- Status Codes:
201 Created – on success
400 Bad Request – if a required field is missing
- Returns:
the new ScheduledReport object
- PATCH /api/reports/scheduled/(int: scheduled_report_id)
Edit an existing scheduled report.
- Status Codes:
404 Not Found – if the specified scheduled report ID is invalid
- Returns:
the new state of the scheduled report object
- DELETE /api/reports/scheduled/(int: scheduled_report_id)
Delete an existing scheduled report.
- Status Codes:
204 No Content – on success
404 Not Found – if the specified scheduled report ID is invalid