Create run
Create a new test run that links to a procedure and either links to an existing unit or automatically creates one. Optionally include metadata, phases, measurements, and logs to capture comprehensive test execution data.
Access
API Key | Access Level | Description |
---|---|---|
User | Full | Users can create runs for any procedure of their organization |
Station | Limited | Stations can only create runs for procedures to which they are currently linked. |
Endpoint
/v1/runs
API key for authentication. Use format: Bearer YOUR_API_KEY
In: header
Array of sub-units that are part of this main unit. Each sub-unit must already exist and will be linked as a sub-component of the main unit under test. If no sub-units are specified, the unit will be created without sub-unit relationships.
Overall test result indicating whether the test passed (true) or failed (false).
Procedure identifier or ID. Create the procedure in the app first, then use the auto-generated UUID.
length <= 255
Specific version of the test procedure used for the run. If none exist, a procedure with this procedure version will be created. If no procedure version is specified, the run will not be linked to any specific version.
length <= 255
ISO 8601 timestamp when the test run began execution. This timestamp will be used to track when the test execution started and for historical analysis of test runs. A separate created_at timestamp is stored internally server side to track upload date.
date-time
Test execution duration in ISO 8601 format. Combined with started_at to calculate the end time of the test execution. If not provided, defaults to zero duration.
"PT0S"
duration
Array of log messages generated during the test execution. Each log entry captures events, errors, and diagnostic information with severity levels and source code references. If no logs are specified, the run will be created without log entries.
Array of test phases with measurements and results. Each phase represents a distinct stage of the test execution with timing information, outcome status, and optional measurements. If no phases are specified, the run will be created without phase-level organization of test data.
The steps
field is deprecated in favor of phases
and measurements
, which provide more detailed test logging. Existing steps
will be auto-converted into a phase
, with a measurement
if they include a numeric value.
The procedure_name
field is deprecated and will be ignored. You can safely remove it from your scripts.
length <= 255
Response Body
from tofupilot.v1 import TofuPilotClient
client = TofuPilotClient()
result = client.create_run(
run_passed=true,
procedure_id="FVT1"
)
print(result)
{
"id": "550e8400-e29b-41d4-a716-446655440000"
}
{
"code": "BAD_REQUEST",
"message": "Part number is required but not provided and no automatic parsing is configured. Provide a part_number parameter or configure serial number parsing in organization settings.",
"issues": []
}
{
"code": "FORBIDDEN",
"message": "Part creation failed.; Revision creation failed.; Batch creation failed.; Unit creation failed.; Version creation failed.; Plan upgrade required.; Monthly limit exceeded.",
"issues": []
}
{
"code": "NOT_FOUND",
"message": "Operator with email {operated_by} does not exist. Create the user first in the app.; Procedure with ID {id} does not exist. Create the procedure first in the app.",
"issues": []
}
{
"code": "UNPROCESSABLE_CONTENT",
"message": "Part number extraction failed for serial number {serial_number}. Provide a part_number parameter explicitly or fix the regex pattern in organization settings.",
"issues": []
}
{
"code": "INTERNAL_SERVER_ERROR",
"message": "Internal server error",
"issues": []
}
How is this guide?