v2 Reference (Preview)/Units/Sub-units
Add sub-unit
Add a sub-unit to a parent unit.
PUT
/v2/units/{serial_number}/children
AuthorizationBearer <token>
API key for authentication. Use format: Bearer YOUR_API_KEY
In: header
Path Parameters
serial_numberstring
Serial number of the parent unit
Length
1 <= length <= 60
child_serial_numberstring
Serial number of the sub-unit to add
Length
1 <= length <= 60
Response Body
from tofupilot.v2 import TofuPilot
# Initialize the TofuPilot client
client = TofuPilot()
# Execute the operation
result = client.units.add_child(
serial_number="UNIT-001",
child_serial_number="SUB-001"
)
# Handle response
print(result)
{
"id": "550e8400-e29b-41d4-a716-446655440000"
}
{
"code": "BAD_REQUEST",
"message": "Procedure name is required",
"issues": []
}
{
"code": "NOT_FOUND",
"message": "Procedure not found: {id}",
"issues": []
}
{
"code": "INTERNAL_SERVER_ERROR",
"message": "Internal server error",
"issues": []
}
How is this guide?