API reference
Automatically generate random calculation inputs and see what the calculation returns
This endpoint allows you to simulate a calculation and therefore helps you understand what inputs a calculation expects and what results it returns. When calling this endpoint, 2 things will happen:
GET/v1/calculations/simulate/{calculationId}
This endpoint expects a calculationId
to be passed as a path parameter.
Parameter | Type | Required |
---|---|---|
calculationId | string | yes |
When successful, the API will return a HTTP status code of 200. In the response you'll find the simulated calculation inputs and the corresponding results. Below you can find an example response for the BMI calculation.
- json
01{02 "simulated_calculation_input": {03 "height": 123,04 "weight": 4105 },06 "simulated_calculation_results": [07 {08 "subresult_id": "BMI",09 "label": {10 "en": "Body Mass Index"11 },12 "unit": {13 "en": "kg/m2"14 },15 "type": "number",16 "result": 27.100271002710027,17 "status": "CALCULATED"18 }19 ]20}
When a calculation for the given calculationId
cannot be found, the API will return a 400 HTTP status code and the following response:
- json
01{02 "data": {03 "error": {04 "message": "Calculation with id \"nonExistentCalculationId\" could not be found."05 }06 }07}
When unsuccessful, the API will return a 500 HTTP status.