Last updated on 16th July 2024
Update the state of an interactive simulation
Name | Located in | Description | Required | Schema |
---|---|---|---|---|
id | path | ID of interactive simulation | Yes | string |
body | body | Optional state to apply to simulation | Yes | inline |
Example request
curl -X PUT http://localhost:8080/api/simulations/interactive/{id} \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{"setup": "true"}'
State will always be applied in the order it appears in this table, regardless of the order in request body.
Parameter | Type | Required | Description |
---|---|---|---|
restart | boolean | Restart the simulation, resetting all inputs and config to default values. | |
config | object | Key value object of config keys to update with values to update to. | |
input | object | Key value object of input field to update with values to update to. | |
setup | boolean | If the simulation should be setup. | |
tick | integer | Tick to run to simulation to. |
Example request body
{
"restart": true,
"config": { "core.prng-seed": 1 },
"input": { "gridsize": 20 },
"setup": true,
"tick": 10
}
Status | Meaning | Description | Schema |
---|---|---|---|
204 | No Content | Request was completed successfully | None |
400 | Bad Request | Request error | Inline |
404 | Not Found | Simulation not found | Inline |
409 | Conflict | Conflict completing request in current state | Inline |
500 | Internal Server Error | Internal server error | Inline |
Status Code 400
Name | Type | Required |
---|---|---|
message | string | true |
Example 400 response body
{
"message": "Could not handle message"
}
Status Code 404
Name | Type | Required |
---|---|---|
message | string | true |
Example 404 response body
{
"message": "Could not find simulation '5af75d69-1926-4ef2-a56f-07ad5f85673b'"
}
Status Code 409
Name | Type | Required |
---|---|---|
message | string | true |
Example 409 response body
{
"message": "Cannot set model tick for model that has not been setup."
}
Status Code 500
Name | Type | Required |
---|---|---|
message | string | true |
Given the id, returns the interactive simulation object.
Name | Located in | Description | Required | Schema |
---|---|---|---|---|
id | path | ID of simulation | Yes | string |
Example request
curl -X GET http://localhost:8080/api/simulations/interactive/{id} \
-H 'Accept: application/json'
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Request was completed successfully | Inline |
404 | Not Found | Simulation not found | Inline |
Status Code 200
Name | Type | Required | Description |
---|---|---|---|
id | string(uuid) | true | |
isStarted | boolean | true | Is simulation ready to take requests |
isBusy | boolean | true | If simulation is currently busy processing, it cannot handle requests. |
metadata | object | true | |
» schema | object | true | Schema of the simulation |
» setup | boolean | true | If simulation has been setup. |
» compileResult | object | true |
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
Name | Type | Required |
---|---|---|
message | string | true |
Example 404 response body
{
"message": "Could not find simulation '5af75d69-1926-4ef2-a56f-07ad5f85673b'"
}
Given the id, deletes the simulation.
Name | Located in | Description | Required | Schema |
---|---|---|---|---|
id | path | id of simulation | Yes | string |
Example request
curl -X DELETE \
http://localhost:8080/api/simulations/interactive/a098275a-307d-4d65-b8a5-47b9b484c609 \
-H 'Cache-Control: no-cache'
Status | Meaning | Description | Schema |
---|---|---|---|
204 | No Content | Request was completed successfully | None |
404 | Not Found | Simulation not found | Inline |
Status Code 404
Name | Type | Required |
---|---|---|
message | string | true |
Example 404 response body
{
"message": "Could not find simulation '5af75d69-1926-4ef2-a56f-07ad5f85673b'"
}