[Posting] Re: Planetscentral API
From:streu
Thread:Planetscentral API
Forum:Bugs
In reply to:Planetscentral API
Date:Thu, 2023-02-02 20:14 GMT

do you have some kind of API / script to get RTS and send TRN files from a batch?

There is a HTTP API (although it's pretty old-style, i.e. not REST).

API playground: https://planetscentral.com/dev/playground.cgi

Beware, it's the real thing, NOT a sandbox. Any POST you do with it affects live data. I assume you can figure out with the browser developer tools how it works.

To log in, use GET with action=whoami on the "user" endpoint, passing api_user and api_password parameters. This returns information about the user, including a token.

To list your games, use GET with action=gamelist on the "host" endpoint, passing api_token (or api_user/api_password).

To upload a turn, use POST with action=trn, api_token, and the file as data attribute.

There currently doesn't seem to be a way to access a result directly from the host, that's just not implemented yet. If you have assigned a game directory on the server, you can use the "file" endpoint, which has "ls" and "get" actions to get it from there; this is what PCC2ng currently does.

The C++ code from PCC2ng is here but it's pretty rough, not very well-documented, and not part of any release yet.

--Stefan

This is a testing version.
It may be incomplete, and have more bugs (or features) than the public live version at planetscentral.com.