REST API - Game webserver

Isles of Yore comes with a built in web-server that allows REST communication with the game world.

To start the server, a rest port must be provided, otherwise the server will not start. In your launch arguments, for example add: -restport=8085. You may substitute 8085 for a custom port.

Requests need to have a header "username", and a header "password", with the respective username and password for the web server. See server configuration for how to fill this in.

Note: when "UserID" is mentioned here, this refers to the user's steamid.


Endpoints:

POST @ /Announce

Announces a message in-game.

Request example:

{
	"message" : "Hello there!"
}

POST @ /Commands

Sends a raw command, like can be done with the in-game console.

Request example:

{
	"Command" : "announce",
	"Arguments" : ["test"]
}

GET @ /Session

Gets session details.

Response example:

{
  "SessionStartUnixUTCTimestamp": "1639405145708"
}

GET @ /Ping

Returns status 200 with message "Pong!" if server is up.


Players

GET @ /Players

Gets a list of players.

Response example:

{
  "Players": [
    {
      "UserName": "SomeUsername",
      "UserID": "SomeID",
      "Species": "Coelophysis",
      "Needs": {
        "Eat": 100,
        "Drink": 100,
        "Oxygen": 100,
        "Rest": 100
      },
      "Growth": 22.5,
      "GrowthStage": "Adult",
      "Health": 100,
      "IsAlive": true,
      "Location": {
        "X": -7746.56640625,
        "Y": -2029.3963623046875,
        "Z": 66.06634521484375
      },
      "LoginUnixUTCTimestamp": "1639411750941"
    }
  ]
}

Optionally, add a query string to get a specific player:

GET@ /Players/?userid=someid

Response example:

{
	"Player": {
		"NetId": "SomeID",
		"LastKnownUsername": "SomeUsername",
		"AllKnownUsernames": [ "SomeUsername" ],
		"LogonTimestamps": [
			"1640006726518",
			"1640006726540"
		],
		"UseCustomNameColour": false,
		"CustomNameColour": {
			"R": 0,
			"G": 0,
			"B": 0,
			"A": 0
		}
	},
	"Pawn": {
		"Species": "Coelophysis",
		"PersistedSkin": {
			"BasePresetId": "",
			"BaseColour": {
				"R": 0,
				"G": 0,
				"B": 0,
				"A": 0
			},
			"Alphas": []
		},
		"OwnerNetId": "SomeID",
		"Location": {
			"X": -6634.7255859375,
			"Y": -1459.6689453125,
			"Z": 66.06634521484375
		},
		"Growth": 901.5,
		"Health": 1700.3333740234375,
		"Stamina": 349.85000610351563,
		"Thirst": 280,
		"Hunger": 300,
		"Oxygen": 30
	},
	"HasPersistedPawn": true
}

GET @ /Player/Records

Gets a list of historical players.

Response example:

{
    "Players": 
    [
        {
            "Player": {
                "NetId": "SomeID",
                "LastKnownUsername": "SomeUsername",
                "AllKnownUsernames": [ "SomeUsername" ],
                "LogonTimestamps": [
                    "1640006726518",
                    "1640006726540"
                ],
                "UseCustomNameColour": false,
                "CustomNameColour": {
                    "R": 0,
                    "G": 0,
                    "B": 0,
                    "A": 0
                }
            },
            "Pawn": {
                "Species": "Coelophysis",
                "PersistedSkin": {
                    "BasePresetId": "",
                    "BaseColour": {
                        "R": 0,
                        "G": 0,
                        "B": 0,
                        "A": 0
                    },
                    "Alphas": []
                },
                "OwnerNetId": "SomeID",
                "Location": {
                    "X": -6634.7255859375,
                    "Y": -1459.6689453125,
                    "Z": 66.06634521484375
                },
                "Growth": 919.5,
                "Health": 1704.3333740234375,
                "Stamina": 348.04998779296875,
                "Thirst": 267,
                "Hunger": 289.60015869140625,
                "Oxygen": 30
            },
            "HasPersistedPawn": true
        },
    [...]
    ]
}


Simulation

GET @ /World

Gets world simulation details.

Response example:

{
	"Time": 7.1193399429321289,
	"Weather": "Clear Skies",
	"Season": "Spring",
	"Day": 5,
	"Month": 12,
	"Year": 2042,
	"Lat": -47,
	"Long": -176.74156188964844
}

GET @ /World/Config

Gets current world simulation configuration details.

Response example:

{
	"Spawn": {
		"SpawnWeights": {
			"Arganodus": {
				"Weight": 1,
				"Min": 0
			},
			"Chinlea": {
				"Weight": 1,
				"Min": 0
			},
			"Dipterus": {
				"Weight": 0.5,
				"Min": 0
			},
			"Diplocaulus": {
				"Weight": 0.69999998807907104,
				"Min": 0
			},
			"Ichthyostega": {
				"Weight": 2,
				"Min": 0
			},
			"Triceratops": {
				"Weight": 1,
				"Min": 0
			},
			"Stegosaurus": {
				"Weight": 0.5,
				"Min": 0
			},
			"Tyrannosaurus": {
				"Weight": 1.2999999523162842,
				"Min": 0
			},
			"Deinonychus": {
				"Weight": 2.5,
				"Min": 0
			},
			"Coelophysis": {
				"Weight": 4,
				"Min": 0
			},
			"Suchomimus": {
				"Weight": 0.69999998807907104,
				"Min": 0
			},
			"Spinosaurus": {
				"Weight": 1,
				"Min": 0
			},
			"Kongonaphon": {
				"Weight": 2.5,
				"Min": 0
			}
		},
		"TotalMaxSpawnedAI": 103,
		"RegulationFrequency": 5
	},
	"World": {
		"Geography": {
			"Lat": -47,
			"Long": -176.74156188964844
		},
		"Weather": {
			"AuroraAtNightChance": 0.15000000596046448,
			"SpringWeatherProbabilities": {
				"Clear Skies": 1,
				"Partly Cloudy": 1.5,
				"Cloudy": 0.60000002384185791,
				"Overcast": 0.5,
				"Foggy": 0.34999999403953552,
				"Light Rain": 0.5,
				"Rain": 0.5,
				"Thunderstorm": 0.40000000596046448,
				"Light Snow": 0.17499999701976776,
				"Snow": 0.10000000149011612,
				"Blizzard": 0
			},
			"SummerWeatherProbabilities": {
				"Clear Skies": 1,
				"Partly Cloudy": 1.5,
				"Cloudy": 0.60000002384185791,
				"Overcast": 0.5,
				"Foggy": 0.20000000298023224,
				"Light Rain": 0.5,
				"Rain": 0.5,
				"Thunderstorm": 0.40000000596046448,
				"Light Snow": 0,
				"Snow": 0,
				"Blizzard": 0
			},
			"AutumnWeatherProbabilities": {
				"Clear Skies": 1,
				"Partly Cloudy": 1.5,
				"Cloudy": 0.60000002384185791,
				"Overcast": 1,
				"Foggy": 0.5,
				"Light Rain": 0.5,
				"Rain": 0.5,
				"Thunderstorm": 0.40000000596046448,
				"Light Snow": 0.25,
				"Snow": 0,
				"Blizzard": 0
			},
			"WinterWeatherProbabilities": {
				"Clear Skies": 1,
				"Partly Cloudy": 1.5,
				"Cloudy": 0.60000002384185791,
				"Overcast": 0.5,
				"Foggy": 0.34999999403953552,
				"Light Rain": 0.15000000596046448,
				"Rain": 0.10000000149011612,
				"Thunderstorm": 0.20000000298023224,
				"Light Snow": 0.5,
				"Snow": 0.5,
				"Blizzard": 0.40000000596046448
			},
			"TimeRangeHoldNewWeather": {
				"X": 60,
				"Y": 300
			}
		},
		"Clock": {
			"StartingHour": 7.1826539039611816,
			"StartingDay": 5,
			"StartingMonth": 12,
			"StartingYear": 2042,
			"TimeZone": 12,
			"AllowDST": true,
			"DSTStartDay": 26,
			"DSTStartMonth": 9,
			"DSTEndDay": 3,
			"DSTEndMonth": 4,
			"DSTChangeHour": 2,
			"GameSpeedDay": 0.80000001192092896,
			"GameSpeedNight": 1.1000000238418579
		}
	},
	"PersistWorld": true
}

@TODO: POST @ /World/Config

Sets active world simulation details.

Response example:

{
  
}

GET @ /AI

Gets current AI details.

Response example:

{
	"AI": [
		{
			"IsActive": true,
			"Species": "Tyrannosaurus",
			"Needs": {
				"Eat": 0,
				"Drink": 100,
				"Oxygen": 100,
				"Rest": 60.000003814697266
			},
			"Growth": 5,
			"GrowthStage": "Juvenile",
			"Health": 100,
			"IsAlive": true,
			"Location": {
				"X": -7048,
				"Y": -2226,
				"Z": 74.661392211914063
			}
		}
	]
}

Teams

GET @ /Teams

Gets current teams and their members

Response example:

{
	"Teams": [
		{
			"IsActiveTeam": true,
			"UniqueId": "1B7EE0E04A897FC2C109D6B1B583651F",
			"TeamLeadUniqueNetId": "SomeID_A",
			"TeamMembers": [
				{
					"UniqueNetIdStr": "SomeID_A"
				},
				{
					"UniqueNetIdStr": "SomeID_B"
				}
			],
			"AllowedMemberSpecies": [
				"Coelophysis"
			],
			"MaxMembers": 20
		}
	]
}

Bans

GET @ /Bans

Gets current bans.

Response example:

{
  "Bans": [
    {
      "BanID": "857E364E4B6C355BBB27749E31438977",
      "UserID": "SomeUserID",
      "LastKnownUsername": "SomeUsername",
      "BannedByUserID": "SomeBannerID",
      "BannedByUserName": "SomeBannerUsername",
      "Reason": "Some reason",
      "TimestampUnixUTC": "1639410049138",
      "DurationInSeconds": 0 //currently not used
    }
  ]
}

PUT @ /Bans

Adds a ban.

Request example:

{
	"UserID" : "SomeID",
	"BannedByUserID" : "SomeOtherID",
	"BanReason" : "SomeReason"
}

DELETE @ /Bans

Removes a ban.

Request example:

{
	"UserID" : "SomeID"
}

Admins

GET @ /Admins

Gets current admins.

Response example:

{
	"Admins": [ "SomeID" ]
}

PUT @ /Admins/?userid=someid

Adds an admin, send the userid encoded through a url query component (?userid=someid).

DELETE @ /Admins?userid=someid

Removes an admin, send the userid encoded through a url query component (?userid=someid).


Misc

POST@ /NameColour

Adds a custom name colour, used in the game chat.

Request example:

{
	"UserID" : "SomeID",
	"UseCustomColour" : true,
	"Colour" : {
		"R": 204,
		"G": 0,
		"B": 204,
		"A": 1
	}
}