Programs
- GET /api/programs/
Get all (or a subset of) registered programs.
Note
Combining query parameters is an AND operation, so a program must match ALL parameters passed to be returned.
- Query Parameters:
machine (int) – set to a machine ID to only include programs on that machine
process (int) – set to the ID of a process to only include programs in that process or
0
to get only programs that are not assigned to a processloaded (int) – set to
1
to only include loaded programs or0
to only include unloaded programsarchived (int) – set to
1
to only include archived programs or0
to only include non-archived programs
- Status Codes:
424 Failed Dependency – if the provided
process
does not exist.
- Returns:
a JSON object mapping program IDs to programs
- PUT /api/programs/
Manually create a program.
The request body should be a (partial) program object (
filename
andmachine_id
are required).- Status Codes:
400 Bad Request – if the filename and/or machine_id fields are missing
201 Created – on success
- GET /api/programs/(int: program_id)
Get information about a single program.
- Parameters:
program_id – the ID of the program
- Status Codes:
404 Not Found – if the program does not exist
- Returns:
the program object
- PATCH /api/programs/(int: program_id)
Update a program in the database.
- Status Codes:
404 Not Found – if the program does not exist
409 Conflict – if the program is being added to a process of a machine other than the machine the program belongs to
424 Failed Dependency – if the program is being added to a process that does not exist
- Parameters:
program_id – The numeric ID of the program to edit.
- Returns:
the updated program object
- DELETE /api/programs/(int: program_id)
Delete a program from the database.
- Parameters:
program_id – The numeric ID of the program to delete.
- Status Codes:
204 No Content – on success
404 Not Found – if the program does not exist
- GET /api/programs/(int: program_id)/overview/(int: year)
- GET /api/programs/(int: program_id)/overview/(int: year)/(int: month)
Get a day-level overview of a program’s production history.
- Parameters:
program_id – The program 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.
- Status Codes:
404 Not Found – if the program doesn’t exist
- Returns:
a JSON object mapping years to objects each mapping “YYYY-MM-DD” to a number of parts produced
- GET /api/programs/(int: program_id)/chart
Get the data required to chart this program.
- Parameters:
program_id – The ID of the program to chart
- Response JSON Object:
program – the program object
parts – maps part IDs to part objects
- 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.
- Status Codes:
404 Not Found – if the program doesn’t exist