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
Server start/stop api #98
Comments
I haven't been actively updating Gamocosm, but I probably should, I've been more productive with my own work lately and it's about time I dust this off again. This is certainly possible. I will try to fix outstanding issues today and update the code and refamiliarize myself with it. Then I'll work on this... hopefully within a week if I don't disappear again? |
Surprisingly, I finished it in a week as promised
Change notice(Although I doubt other people will be using the API at this time) Anyone who uses this API for now should keep an eye on this thread/message me to contact them for changes to the API. It's quite simple so it might not have to be changed, but based on @logwet's feedback and anything else I think of it may change |
The API interface requires sign in/cookie authentication. I couldn't access it through my python script until I copied the cookie for the Gamocosm session into the headers I'm passing into It'd also be nice to have end points for:
|
Ah yes the cookie/session thing was an oversight. I'll look into it. As for authentication data in plain text, what do you mean? Gamocosm uses https, which I have to double check, but IIRC endpoints (the rest of the URL after the domain, which has your server ID and API key) are encrypted |
The cookie/session issue should be fixed. I forgot to mention there was already a The
Finally, all endpoints except for
In recap, there are 7 endpoints, accessible as
|
My wording was weird. I meant that I didn't want to hard code the cookie, but you've already solved that issue. I'd like to be able to send commands to the server through the MCSW. Can you either add an endpoint to grab the MCSW key, or a POST endpoint to send a command to the server.
|
I've whipped up a quick bot to do some testing with Discord. It's very ugly, but it works. |
Nice bot! I added an
|
Is the [server id] supposed to be the DO id, or something else? Because when I use the id from DO I always get {"error":"Not found"} as a response |
@oscaretti Eg. If I accessed my server from |
When I used |
@CoWinkKeyDinkInc you are supposed to make a post request to endpoints other than /status. I'm on my phone but I think the command was Also keep in mind there seems to be a bug where /stop sometimes fails to destroy the droplet and only creates a snapshot and stops the minecraft server(#113). You might need to call the stop endpoint a few times for it to actually work and then delete old snapshots(you can use the digitalocean api for that) |
I wouldn't encourage to build a project on top of gamocosm until #113 is fixed because it's very annoying if the server doesn't get deleted and you have to manually delete the snapshot every time the server gets stopped. |
It's been a week since the fixes/last status update for #113, and it seems like there hasn't been any issues. Also, the latest commit adds a layer of redundancy for the snapshotting issue described. If a server didn't start correctly, the (old) snapshot it was created from may not be destroyed. Now, after stopping a server, once it successfully creates a new snapshot, it will also delete the old snapshot if present. So hopefully we don't see stray snapshots anymore |
I've made a simple discord bot in java that makes use of this API, and lets you have any amount of servers configured, one per channel. I'm leaving this here in case someone in the future wants extra reference or a java wrapper for the API: |
I'm getting a generic |
I am also getting a code 500 response from the |
I want to write a Discord bot that'll allow the members of my server to start the server (ie. When Gamocosm creates a DO droplet from the snapshot of the previous session) outside of the scheduled autostart and shutdown hours. To do that I'd need to access an API that would interact directly with the server manager on https://gamocosm.com/
I already know there's an API to interact with servers that are already online, the MCSW, but as far as I'm aware there's no such API for servers that are offline.
Is it possible to implement this?
Thanks
The text was updated successfully, but these errors were encountered: