Skip to main content
Version: 2.1

POST

Creates and run a scenario simulation and returns the object with its various attributes.

Request​

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": 10,
"scenarioData": {
"0": {"spending": 200},
"4": {"spending": 100, "interest": 0.04}
}
}]
}'

Windows user File

Characters need to be escaped when using scenarios in windows on cmd.

'{"name": "Game of Life"}' must become '{\"name\": \"Game of Life\"}'

Body Schema​

ParameterTypeRequiredDescription
modelNamestringtrueName of model to run a scenario for
scenarios[object]List of objects describing scenarios to run for this model
>nameobjectA 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
>runsintegerNumber of times to run this scenario.
>seeds[long]A list of seeds to set for the runs of this simulation.
>scenarioDataobjecttrueKey value pairs of ticks to the inputs to set for those ticks
inputobjectDetails of input files to read the scenario data from. Required if scenarios field isn't present.
>uristringtruePath to files containing scenario data
outputobjecttrueDetails of the simulation's output
>uristringtruePath to output scenario data results
>formatstringOutput data format. Options are parquet or json, defaults to json.
customExportMetadataobjectAn object containing custom fields that will be included in the metadata.json file as part of the data output.

Example request body with inline scenario definition

{"modelName": "Simple Credit Card", 
"output": {"uri": "scenarioFolder" },
"scenarios":[{
"name": "myScenario",
"runs": 10,
"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"}
}
If a request body has both inline scenario definition and and input path, the input path will be ignored.

Response​

StatusMeaningDescription
200OKSuccessfully created. The session ID is returned in a cookie named simudyneSessionID. You need to include this cookie in subsequent get requests.
404Not FoundSimulation not found.

Response Schema​

Status Code 200

NameTypeRequiredDescription
idstring(uuid)true
namestringtrue
descriptionstringtrue
publicbooleantrue
sessionstring(uuid)truesimudyneSessionID cookie
kindstringtrue

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

NameTypeRequired
messagestringtrue

Example 404 response body

{
"message": "SimulationRegistry: Could not find requested simulation default."
}