Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

API Specification

Lilith edited this pageJun 2, 2024 ·34 revisions

End Points

WIP all contents of this page are subject to change.

Current API version:v1 (all current endpoints will of the formmac/<endpoint>/v1)

Do:

Terminology

  • verdicts: one of none/trusted/cheater/sus as set by user, but if masterbase reports convict then override the user setting in all scenarios
  • tags: entirely separate set of strings. used to display if user is for example a friend, a MAC admin, etc

Steam API Key Renaming

  • 'personaname' gets renamed to 'name'
  • 'avatarfull' gets renamed to 'pfp'
  • 'avatar' gets removed
  • 'avatarmedium' gets removed

Player JSON Object Constraints

  • steamInfo may be NULL if player steam data hasn't been pulled yet
  • customData will never be NULL, just empty if nocustomData present

game (GET)

Returns the full game object, including server and lobby details, as well as all players currently in that server/lobby.

URL

GET mac/game/v1

Request Form Data

None

No payload required. This endpoint should be hit every time the player joins a new lobby/game. To update a lobby, usemac/user/v# instead.

Example Request

{}

Code:

importrequestsbase="..."response=requests.get(f"{base}/mac/game/v1")

Response Parameters

ParameterTypeDescription
playerslistA list of objects of all currently in-game players. (Seemac/user/v1 for info on player objects)
mapstringThe current game map
ipstringThe current server IP as returned fromstatus.
maxPlayersintegerThe max players allowed in the lobby (this may differ from the actual value)
gamemodeobjectThe gamemode object, which contains the type (string), matchmaking and vanilla flags

Example Response

{"players": [    {"isSelf":false,"name":"x","steamID64":"x","steamInfo": {"accountName":"x","pfp":"x","pfphash":"x","vacBans":"x","isFriend":true,//...Any Other info you can find      },"gameInfo": {"team":3,// team is an int 0,1,2,3"ping":64,"kills":0,"deaths":0,//...      },"customData": {/* Store your own json here! */},"localVerdict":"suspicious","convicted":false,"tags": ["Convicted","MAC Admin"]    },    {//....    }  ],"map":"X","ip":"X","hostname":"X","maxPlayers":32,"numPlayers":17,"gamemode": {"matchmaking":false,"type":"Arena","vanilla":false  }}

Response contains server data, game details such as map, IP and gamemode, and a list of every player in the game (including self)Possible tags: "Recently Disconnected", "Joining", "Steam Friend", "Same regional DB", "Competitive Player", "MegaAntiCheat Admin"Possible verdicts: "none", "cheater", "sus", "trusted", "convict"


user (POST)

Returns all relevant information that the backend has on provided list of users.

URL

POST mac/user/v1

Request Form Data

ParameterTypeDescriptionRequirement Type
userslistA list of steamID64s to return data on.Required

Example Request

{"users": [123456789,1235463235,892357]}

Code:

importrequestsparams= {"users": [123456789,1235463235,892357]}base="..."response=requests.post(f"{base}/mac/user/v1/",params=params )

Response Parameters

ParameterTypeDescription
playerslistA list of player objects, containing the intersection of the set of players requested and the set of players in the game.
errorsobjectAn object containing a key-value pair for each steamID64 or name that the backend failed to find data on, and the reason.
<player>.isSelfboolIf this player object represents the player currently running this client.
<player>.namestringthe in-game name of this player, which may or may not vary from the steam name ('personaname' a.k.a <player>.steamInfo.accountName )
<player>.steamID64stringthe players steamID64
<player>.steamInfoobject OR NULLan object containing all of the data returned from the steam API on this steam account. Some keys will be renamed (see top of page for info). Seehere for more details. NOTE: This key may be NULL if player data not returned.
<player>.gameInfoobjectan object containing all of the game data captured by the backend relevant to this player (i.e. team, score, ping)
<player>.tagslistThe set of all tags collated from local, regional and remote, with consideration for tag precedence.

Example Response

{"players": [    {"isSelf":false,"name":"x","steamID64":"x","steamInfo": {"accountName":"x","pfp":"x","pfphash":"x","vacBans":"x","isFriend":true,"loccountrycode":"AU","timecreated":9572357// ... Any Other info you can find      },"gameInfo": {"team":3,// team is an int 0,1,2,3"ping":64,"kills":0,"deaths":0,// ...      },"customData": {/* Store your own json here! */},"tags": ["Convicted","MAC User"]"localVerdict":"suspicious","convicted":false,    },    {// ...    }  ]}

The response shall contain aplayers object for each player that was both provided in the payload, and found in the game. And anerrors object for each player that the back-end could not return aplayers object for


user (PUT)

A put to theuser endpoint can be used to update locally stored data on the given user. Most significant is the ability to update the local verdict on any number of given users.

URL

PUT mac/user/v1

Request Form Data

ParameterTypeDescriptionRequirement Type
objectan object keyed by a users steamID64, containing an arbitrary number of namespaced key-value pairs of user persistent data to update.Required

Example Request

{  "76561198210264393": {      "localVerdict": "Suspicious",      "customData": { /* your custom json here! */ }  },  "76561198782264188": {      "localVerdict": "Suspicious",      "customData": { /* your custom json here! */ }  }}

Code:

importrequestsbase="..."params= {"76561198210264393": {"localVerdict":"Suspicious","customData": {/*yourcustomjsonhere!*/ }  },"76561198782264188": {"localVerdict": "Suspicious,"customData": {/*yourcustomjsonhere!*/ }  }}response=requests.put(f"{base}/mac/user/v1",params=params)

ThelocalVerdict object may contain any number of"<steamID64>": "verdict", key-value pairs, to enable bulk updates of the local verdict.

Response Parameters

ParameterTypeDescription
errorsobjectan object of key-value pairs of steamID64's and the reason why a given player could not be updated.

Example Response

{"errors": {}}

The response shall contain an errors object that would detail any errors encountered whilst trying to update the specified players stored data.

pref (GET)

Returns the full list of locally stored user preferences concern the client (both front-end and back)

URL

GET mac/pref/v1

Request Form Data

None

Example Request

{}

Code:

importrequestsbase="..."response=requests.get(f"{base}/mac/pref/v1")

Response Parameters

ParameterTypeDescription
internalobjectan object containing all internal prefs created and handled by the MAC official backend
externalobjectan object containing all custom/non-mac defined user preferences

Data spec TBC, then this will be updated.

Example Response

{"internal": {"tf2Directory":".../Team Fortress 2","rconPassword":"password","steamApiKey":"API_KEY_HERE"  },"external": {"customPreference": {...}  }}

The response shall be an object containing a set of key-value pairs where the key is the name of the stored user pref, and the value is whatever type is stored under that key (can be literal, string, object or list). These will be distinguised by internal values and external values.

pref (PUT)

A post topref is to update user preferences and settings as interacted with via the front-end client.

URL

PUT mac/pref/v1

Request Form Data

ParameterTypeDescriptionRequirement Type
internalobjectan object containing the updated value(s) of the given internal user preference key name(s).Optional
externalobjectan object containing the updated value(s) of the given external user preference key name(s).Optional

Any number of keys may be specified in the params.

Example Request

{"internal": {"tf2Directory":".../Team Fortress 2","rconPassword":"password","steamApiKey":"API_KEY_HERE"  },"external": {"customPreference": {...}  }}

Code:

importrequestsbase="..."params= {"internal": {"autokick_enabled":True},"external": {"autokick_interbal":60}}response=requests.post(f"{base}/mac/pref/v1",params)

Response Parameters

ParameterTypeDescription
changesobjectAn object containing the key-value pairs of keys that were changed, and the value of what they now represent
errorsobjectAn object containing all of the keys that could not be changed, and the reason why

Example Response

{"changes": {"internal": {"autokick_enabled":True    },"external": {"xyz":"foo bar"    },  }"errors": {/* errors will only ever concern internal prefs as we don't track existance of external prefs */"autokick_interbal":"A key of that name does not exist."  }}

events (GET)

The client opens a get request to this endpoint, which returns an event payload whenever an event occurs (i.e. vote_started, vote_update, vote_ended, lobby_joined, lobby_left). This endpoint opens a HTTP event stream type, which means the backend does not close the connection to the front end, even after a response is returned. This is because the same endpoint hit is used to stream all events back to the front end.

URL

GET mac/events/v1

Response Parameters

ParameterTypeDescription
eventstringa key describing the event that has occured, such as "mac:vote_started", or "mac:lobby_joined"
dataobjectthe event payload data

List of allmac namespaced events:

  • mac:vote_started
  • mac:vote_update
  • mac:vote_finished
  • mac:lobby_joined
  • mac:lobby_left

Example Response

{"event":"mac:vote_XXXX","data" : {/* event data goes here, such as "yes_votes": 7, "no_votes": 3, etc... */},}

history (GET)

Returns a list of all the recent players the local client has interacted with, up to the last 100 players. Acceptsfrom= andto= params to query for data within a specific range.

URL

GET mac/history/v1

GET mac/history/v1?from=xyz&to=abc

Response Parameters

ParameterTypeDescription
playerslistA list of player objects, in order of most recently encountered to oldest.

commands (POST)

The frontend canPOST a list of commands to the backend to execute in the in-game console. A number of commands have dedicated structures for convenience (documented in the example), otherwise acustom object can be provided to execute any arbitrary console command.

URL

POST mac/commands/v1

Request Form Data

ParameterTypeDescriptionRequirement Type
commandsobject[]A list containing 0 or more commands to be executed in the in-game console.Required

Each command object has its own arguments, which are listed below:

Commands available can include:

  • say[Team]
    • Args -> String
    • NOTE: The value after the "say" key is a string, not an object
  • kick
    • Args -> userid: string, reason: string
  • sm_[un]ban
    • Args:
    • If ban -> player: SteamID64 String, time: u64, reason: string
    • If unban -> player: SteamID64 String
  • sm_kick
    • Args -> player: SteamID64 String, reason: string
  • sm_[un]gag
    • Args -> player: SteamID64 String
  • sm_[un]mute
    • Args -> player: SteamID64 String
  • sm_[un]silence
    • Args -> player: SteamID64 String
  • sm_slay
    • Args -> player: SteamID64 String
  • custom
    • Args -> String
    • NOTE: The value after the "custom" key is a string, not an object

Example Request

{"commands" : [      {"say" :"Message!" },      {"sayTeam" :"Team message!" },      {"kick" : {"player" :"<gameInfo.userid>","reason":"cheating" } },      {"custom" :"<Insert command here>" },      {"sm_ban" : {"player":"76561198210264393","time":0,"reason":"Cheating" } }    ]}

PlayerList (GET)

Returns the list of PlayerRecords stored on disk

URL

GET mac/playerlist/v1

Response Parameters

ParameterTypeDescription
recordslistA list of PlayerRecord objects, as specified on disk.

Example Response

{"records" : {"path":"/path/to/file/...","<steam id>": {"customdata": {},"verdict":"<Verdict Enum>"},..."<steam id>": {"customdata": {},"verdict":"<Verdict Enum>"},  }}

SMCommand (POST) DEPRECATED

URL

POST mac/smcommand/v1

Response Parameters

ParameterTypeDescription
commandstrThe command to invoke, one of: [un]ban, kick, [un]gag, [un]mute, [un]silence, slay
targetstrThe SteamID64 of the player target of the command
additional_argumentsstr[]A list of additional arguments to provide to the command, in order

Example Payload

{"command":"ban","target":"76561198210264393","additional_arguments": ["0","cheating"],}
Clone this wiki locally

[8]ページ先頭

©2009-2025 Movatter.jp