/api/simulations/batch

Last updated on 12th October 2022

Note: if you wish to modify variables in Globals please make sure any inputs are prefaced with system. or are contained within a system object.

POST

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

Request

Example request body

curl -X POST \
  http://localhost:8080/api/simulations/batch \
  -H 'Cache-Control: no-cache' \
  -H 'Content-Type: application/json' \
  -d '{"input":{"system":{"fillFactor": 0.5}},
	"ticks": 300,
	"runs": 200,
	"name":"Game of Life"
}'

Body Schema

Parameter Type Required Description
name string true Name of model to create batch simulation for
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.
runs integer true Number of times to run full simulation.
ticks integer true Number of ticks to run each simulation run to.

Example request body

{
  "input": { "system": { "fillFactor": 0.5 } },
  "config": {
    "core-abm-spark.master-url": "local[*]",
    "core-abm-spark.log-level": "WARN"
  },
  "ticks": 300,
  "runs": 200,
  "name": "Game of Life"
}

Response

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.

Response Schema

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."
}

GET

Returns a list of running batch simulations for model

Request

Example request body

curl -X GET \
  'http://localhost:8080/api/simulations/batch?name=Game%20of%20Life' \
  -H 'Cache-Control: no-cache'

Parameters

Name Located in Description Required Schema
name query param Name of model Yes string

Response

Status Meaning Description
200 OK Successfully created.
400 Bad Request Request error Inline
404 Not Found Simulation not found Inline
500 Internal Server Error Internal server error Inline

Response Schema

Status Code 200

Name Type Required Description
results [object] true
» id string(uuid)
» name string
» description string
» public boolean
» session string(uuid) simudyneSessionID cookie
» kind string

Example 200 response body

{
  "results": [
    {
      "id": "0021674-3e3c-4ca7-87fc-e800c69feecd",
      "name": "Game of Life",
      "description": "string",
      "public": true,
      "session": "40dc68d-d798-46cb-bcfb-06c6a16a3492",
      "kind": "pojo"
    }
  ]
}

Status Code 400

Name Type Required
message string true

Example 400 response body

{
    "message": "No usable value for ticks\nDid not find value which can be converted into int"
}

Status Code 404

Name Type Required
message string true

Example 404 response body

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

Status Code 500

Name Type Required
message string true

Example 500 response body

{
   "message": "Exception during input. Cannot set float field `fillFactor` to non float value `\"three\"`."
}