Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REST API #97

Open
gazwald opened this issue Aug 19, 2022 · 4 comments
Open

REST API #97

gazwald opened this issue Aug 19, 2022 · 4 comments
Labels
Milestone

Comments

@gazwald
Copy link
Member

gazwald commented Aug 19, 2022

API

Initial Web interface/API specification

Endpoints

  • Each endpoint, unless otherwise stated, to return either plain, HTML, or JSON content depending on the request.
  • Endpoints are listed in the order they'll be prioritised

Servers

Endpoint Methods Description Plain JSON HTML
/servers GET return a list of servers (address:port only) yes yes yes
/servers?game=<game> GET return a list of servers (address:port only) for <game> running any mod yes yes yes
/servers?game=<game>?mod=<mod> GET return list of servers (address:port only) for <game> running <mod> yes yes yes
/servers/<game> GET return a list of servers (address:port only) for <game> running any mod yes yes yes
/servers/<game>/<mod> GET return list of servers (address:port only) for <game> running <mod> yes yes yes
/server/<server id> GET return all information for <server id> no yes no

Games

Endpoint Methods Description Plain JSON HTML
/games GET return list of all games we currently have active servers for no yes no

Players

Endpoint Methods Description Plain JSON HTML
/players/<server id> GET return list of all players in <server id> if server is active no yes no
/players/<game> GET return list of all players in all active <game> servers no yes no

Notes

JSON Filtering

  • At a later date any endpoint that supports a JSON response will be updated to allow a POST request containing filtering information.

Fast API

@gazwald gazwald added this to the Alpha milestone Aug 19, 2022
@gazwald gazwald mentioned this issue Aug 20, 2022
@darkshade9
Copy link

Regarding /server/<server id>, is this ID generated (integer or GUID) or is it keyed off of the IP:PORT combo to define a unique server id/instance?

Thoughts on having GET requests be parameterized, a la /servers?game=quake2&mod=action as the filter mechanism?

@gazwald
Copy link
Member Author

gazwald commented Aug 29, 2022

Regarding /server/<server id>, is this ID generated (integer or GUID) or is it keyed off of the IP:PORT combo to define a unique server id/instance?

Server ID is currently the ip:port combination.

Although that brings up a good point about how that ID will look with URL encoding.

Thoughts on having GET requests be parameterized, a la /servers?game=quake2&mod=action as the filter mechanism?

Had planned for querystring to pop up at some point for additional filtering. I think it's probably cleaner to support it for all filtering including game and mod like your example - makes bookmarking easier. Then have the addition of the hierarchical method /servers/<game>/<mod> for flexibility later on.

I'll update the initial issue comment later with some more fleshed out ideas.

@darkshade9
Copy link

I'm thinking about the end user utilizing the API, as a broad, sweeping "get me all the servers and their info" or a focused "I only care about this server" type queries. Q2Pro currently runs this query and parses the JSON output to format the server list specifically for the action mod: pushmenu servers "http://q2servers.com/?g=action&raw=1", I imagine this would be the majority of use?

@gazwald
Copy link
Member Author

gazwald commented Sep 6, 2022

http://q2servers.com/?g=action&raw=1 is text/plain not JSON. I initially started working on this master because they didn't output JSON 😂 ... which seems pretty minor now after all the other work.

I've updated the initial issue with added detail about requests, query strings, and responses.

You're right that the majority of use would be just "get me all the servers" . Main reason for having things more nuanced would be for web browser access or if someone feels like writing a mobile app for it in the future. Not necessary for the bulk of initial traffic though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants