Difference between revisions of "API"

From Tycoon Gaming
Line 27: Line 27:
 
  -- int user_id
 
  -- int user_id
 
  -- vec3 position
 
  -- vec3 position
 +
-- object owned_vehicles
 +
--- object[string vehicle_type]!
 +
---- string vehicle_spawn
 
  -- object vehicle
 
  -- object vehicle
 
  --- int vehicle_class
 
  --- int vehicle_class
Line 33: Line 36:
 
  --- string! vehicle_label
 
  --- string! vehicle_label
 
  --- string! vehicle_name
 
  --- string! vehicle_name
 +
--- bool? has_trailer
 +
--- string! trailer
 +
--- string! vehicle_spawn
 
  -- object job
 
  -- object job
 
  --- string group
 
  --- string group

Revision as of 17:57, 7 August 2020

Transport Tycoon API

Root API URI is the servers address

API is available per server instance

Legend

type name (data type and a property name)
type? name (data type may vary based on data context)
type! name (data might not exist based on data context)

Note: Array data types do not contain named properties, the names used here are for clarifiation

Get world information for online players

Returns a list of all online players with positional data.

Their current mode of transportation and some other details are also included.

This endpoint is used to produce the servers livemap.

GET /status/map/positions.json
object
- int time
- array[array player] data
-- string name
-- int source
-- int user_id
-- vec3 position
-- object owned_vehicles
--- object[string vehicle_type]!
---- string vehicle_spawn
-- object vehicle
--- int vehicle_class
--- string vehicle_type
--- int! model
--- string! vehicle_label
--- string! vehicle_name
--- bool? has_trailer
--- string! trailer
--- string! vehicle_spawn
-- object job
--- string group
--- string name

Get server details and online players

Returns the servers name and details, as well as data for every player online.

This endpoint is used to produce the server list: http://connect.tycoon.community/

GET /status/widget/players.json
object
- object server
-- string name
-- string motd
-- string number
-- string region
-- string beta
-- string uptime
-- int limit
- array[array player] players
-- string name
-- int source
-- int user_id
-- string? avatar
-- bool staff
-- string job_name
-- bool whitelist

Get resource configurations

This can be used to easily get vector data for routes etc. in certain jobs Not all resources have viewable configs

GET /status/config/[resource]
returns a raw .lua file dump