Skip to main content
Version: 2.2

PUT

Update the state of an interactive simulation

Request​

Parameters​

NameLocated inDescriptionRequiredSchema
idpathID of interactive simulationYesstring
bodybodyOptional state to apply to simulationYesinline

Example request

curl -X PUT http://localhost:8080/api/simulations/interactive/{id} \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{"setup": "true"}'

Body Schema​

State will always be applied in the order it appears in this table, regardless of the order in request body.

ParameterTypeRequiredDescription
restartbooleanRestart the simulation, resetting all inputs and config to default values.
configobjectKey value object of config keys to update with values to update to.
inputobjectKey value object of input field to update with values to update to.
setupbooleanIf the simulation should be setup.
tickintegerTick to run to simulation to.

Example request body

{
"restart": true,
"config": { "core.prng-seed": 1 },
"input": { "gridsize": 20 },
"setup": true,
"tick": 10
}

Response​

StatusMeaningDescriptionSchema
204No ContentRequest was completed successfullyNone
400Bad RequestRequest errorInline
404Not FoundSimulation not foundInline
409ConflictConflict completing request in current stateInline
500Internal Server ErrorInternal server errorInline

Response Schema​

Status Code 400

NameTypeRequired
messagestringtrue

Example 400 response body

{
"message": "Could not handle message"
}

Status Code 404

NameTypeRequired
messagestringtrue

Example 404 response body

{
"message": "Could not find simulation '5af75d69-1926-4ef2-a56f-07ad5f85673b'"
}

Status Code 409

NameTypeRequired
messagestringtrue

Example 409 response body

{
"message": "Cannot set model tick for model that has not been setup."
}

Status Code 500

NameTypeRequired
messagestringtrue

GET

Given the id, returns the interactive simulation object.

Request​

Parameters​

NameLocated inDescriptionRequiredSchema
idpathID of simulationYesstring

Example request

curl -X GET http://localhost:8080/api/simulations/interactive/{id} \
-H 'Accept: application/json'

Response​

StatusMeaningDescriptionSchema
200OKRequest was completed successfullyInline
404Not FoundSimulation not foundInline

Response Schema​

Status Code 200

NameTypeRequiredDescription
idstring(uuid)true
isStartedbooleantrueIs simulation ready to take requests
isBusybooleantrueIf simulation is currently busy processing, it cannot handle requests.
metadataobjecttrue
» schemaobjecttrueSchema of the simulation
» setupbooleantrueIf simulation has been setup.
» compileResultobjecttrue

Example 200 response body


{
"id": "998436e0-a2df-427b-9c70-b07ba99a54fd",
"isStarted": true,
"isBusy": false,
"metadata": {
"kind": "pojo",
"schema": {},
"setup": true,
"compileResult": {
"hasErrors": false,
"hasWarnings": false,
"files": {}
}
}
}


Status Code 404

NameTypeRequired
messagestringtrue

Example 404 response body

{
"message": "Could not find simulation '5af75d69-1926-4ef2-a56f-07ad5f85673b'"
}

DELETE

Given the id, deletes the simulation.

Request​

Parameters​

NameLocated inDescriptionRequiredSchema
idpathid of simulationYesstring

Example request

curl -X DELETE \
http://localhost:8080/api/simulations/interactive/a098275a-307d-4d65-b8a5-47b9b484c609 \
-H 'Cache-Control: no-cache'

Response​

StatusMeaningDescriptionSchema
204No ContentRequest was completed successfullyNone
404Not FoundSimulation not foundInline

Response Schema​


Status Code 404

NameTypeRequired
messagestringtrue

Example 404 response body

{
"message": "Could not find simulation '5af75d69-1926-4ef2-a56f-07ad5f85673b'"
}