Evaluation using REST API
You can use the following REST API requests to evaluate Teamwork Cloud projects on the server.
Server-side evaluation is available only with the Teamwork Cloud Enterprise license.
Evaluate a parameter or expression
This REST API request evaluates the specified Teamwork Cloud project parameter or expression.
The following table describes the parameters used in the REST API request:
| Parameter | In | Required or optional | Description |
|---|---|---|---|
| projects | path | required | The Teamwork Cloud project ID. |
| commits | path | optional | The commit ID of the Teamwork Cloud project. If the commit ID is not specified, the latest committed version is used instead. |
| context | path | optional | The context path of the outputs, inputs, and expressions used to evaluate and retrieve data, e.g., SpacecraftMassRollup::spaceCraft |
| inputs | body | optional | The set of inputs to be provided for the evaluation. Only inputs with initial values can be modified during evaluation. |
| outputs | body | optional | The set of outputs to be obtained after the evaluation. If no outputs are specified, all values are returned based on the specified context. |
| expressions | body | optional | The parameter or expression you want to evaluate. |
Request and response example with the request body
POST /projects/dc8b24ee-462d-4874-8b52-b85978f242cc/evaluate?context=SpacecraftMassRollup::spaceCraft
{
"inputs":
{
"propulsion.thruster.me":10,
"telecom.amplifier.me":15
},
"outputs":
[
"me",
"propulsion.mee",
"propulsion.tank.me",
"propulsion.thruster.me",
"telecom.me",
"telecom.antenna.me",
"telecom.amplifier.me"
]
}
Response:
{'outputs':
{'me': 144.0,
'propulsion.tank.me': 100.0,
'propulsion.thruster.me': 10.0,
'telecom.me': 34.0,
'telecom.amplifier.me': 15.0,
'telecom.antenna.me': 19.0
}
}
Request and response example with the request body
POST /projects/fa6e7f27-f922-4718-aba4-6b909d6d1dcc/evaluate
{
"inputs":
{
"TradeStudyAnalysis::VehicleAlternatives::vehicle_A.grossMass":2000,
"TradeStudyAnalysis::VehicleAlternatives::vehicle_A.grossMass":1000
}
"expressions":
[
"TradeStudyAnalysis::VehicleAlternatives::vehicle_A.stoppingDistance-TradeStudyAnalysis::VehicleAlternatives::vehicle_B.stoppingDistance"
]
}
=== Response ===
{
'expressions':
['TradeStudyAnalysis::VehicleAlternatives::vehicle_A.stoppingDistance-TradeStudyAnalysis::VehicleAlternatives::vehicle_B.stoppingDistance':56.9344
]
}
Display an interactive HTML table
GET /projects/<projectID>/commits/<commitID>/evaluate/table-view?context=<contextPath>?params=<paramsList>?title=<tableTitle>?verification=<FAIL/ALL/NONE>
This REST API request returns a URL to an interactive HTML table that dynamically retrieves data based on the specified context, parameters and/or expressions.
The following table describes the parameters used in the REST API request:
| Parameter | In | Required or optional | Description |
|---|---|---|---|
| projects | path | required | The Teamwork Cloud project ID. |
| commits | path | optional | The commit ID of the Teamwork Cloud project. If the commit ID is not specified, the latest committed version is used instead. |
| context | path | optional | The context path of the table parameters and/or expressions used to evaluate and retrieve data, e.g. SpacecraftMassRollup::spaceCraft |
| params | path | optional | A comma-separated list of the parameters and/or expressions to display. Use the keyword 'all' to include all available parameters based on the specified context. |
| title | path | optional | The title of the HML table. |
| verification | path | optional | Specify which verification results to display: FAIL - failing values are highlighted in red; ALL - both failing and passing values are highlighted in red and green, respectively; NONE - no verification results are displayed. |
Request example
GET /projects/dc8b24ee-462d-4874-8b52-b85978f242cc/commits/3fa85f64-5717-4562-b3fc-2c963f66afa6/evaluate/table-view?context=SpacecraftMassRollup::spaceCraft¶ms=me,propulsion.tank.me,propulsion.thruster.me&title=SpaceCraftMassRollup
Request example
GET /projects/dc8b24ee-462d-4874-8b52-b85978f242cc/commits/3fa85f64-5717-4562-b3fc-2c963f66afa6/evaluate/table-view?context=SpacecraftMassRollup::spaceCraft¶ms=all&title=SpaceCraftMassRollup?verification=fail
Request example
GET /projects/dc8b24ee-462d-4874-8b52-b85978f242cc/evaluate/table-view?params=SpacecraftMassRollup::spaceCraft.me,SpacecraftMassRollup::spaceCraft.propulsion.tank.me&title=SpaceCraftMassRollup