Last updated on 16th July 2024
Creates and runs a scenario simulation and returns an object with its various attributes.
Example request body
curl -X POST \
http://localhost:8080/api/simulations/scenario \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/json' \
-d '{
"modelName": "Simple Credit Card",
"output": {"uri": "scenarioFolder" },
"scenarios":[{
"name": "myScenario",
"runs": 3,
"seeds": [1234, 2314, 4213]
"scenarioData": {
"0": {"spending": 200},
"4": {"spending": 100, "interest": 0.04}
}
}]
}'
Parameter | Type | Required | Description |
---|---|---|---|
modelName | string | true | Name of model to run a scenario for. This is the name that the model is registered with when starting the server. |
scenarios | [object] | List of objects describing scenarios to run for this model | |
>name | object | A user specified name for the scenario. If not provided, scenario_{id} will be used as the name, where id is the index of this scenario in the array of scenarios | |
>runs | integer | Number of times to run this scenario. | |
>seeds | [long] | A list of seeds to set for the runs of this simulation. | |
>scenarioData | object | true | Key value pairs of ticks to the inputs to set for those ticks. The tick `0` corrspond to the mode setup |
input | object |
Details of input files to read the scenario data from. The name of the file will be used as the name of the scenarios. Required if scenarios field isn't present. If scenarios' fields are present, input will be ignored. |
|
>uri | string | true | Path to the files containing the scenario data |
output | object | true | Details of the simulation's output |
>uri | string | true | This is the root directory that the files generated by the model will be output to. Within this directory, a folder will be created for the entire run named using the uuid of the run (which is returned in the POST response, and a folder will be created for each run of the scenario |
customExportMetadata | object | An object containing custom fields that will be included in the metadata.json file as part of the data output. | |
config | object | Key value object of config keys to update with values to update to. |
Example request body with inline scenario definition
{"modelName": "Simple Credit Card",
"output": {"uri": "scenarioFolder" },
"scenarios":[{
"name": "myScenario",
"runs": 10,
"ticks": 20,
"scenarioData": {
{
"0": {"spending": 200},
"4": {"spending": 100, "interest": 0.04}
}
}
}]
}
Example request body with scenario from input
{"modelName": "Simple Credit Card",
"output": {"uri": "scenarioFolder" },
"input":{"uri": "/path/to/inputFiles"}
}
Status | Meaning | Description |
---|---|---|
200 | OK | Successfully created. The session ID is returned in a cookie named simudyneSessionID . You need to include this cookie in subsequent get requests. |
404 | Not Found | Simulation not found. |
Status Code 200
Name | Type | Required | Description |
---|---|---|---|
id | string(uuid) | true | |
name | string | true | |
description | string | true | |
public | boolean | true | |
session | string(uuid) | true | simudyneSessionID cookie |
kind | string | true |
Example 200 response body
{
"id": "d7558ad9-3405-4a4c-972a-531a87fdcd27",
"name": "Game of Life",
"description":
"The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970.",
"public": false,
"session": "760b2d3e-20b2-42e6-9655-58e662e79e73",
"kind": "pojo"
}
Status Code 404
Name | Type | Required |
---|---|---|
message | string | true |
Example 404 response body
{
"message": "SimulationRegistry: Could not find requested simulation default."
}