API Getting Star Information

What is o data

I would love to hear whenever an official API comes out, and I’d love to help with testing.

I wrote a PHP client based on reverse engineering the game’s interactions with the server and would love to update it to support the official API and usage of keys instead of credentials.

Open Data Protocol or OData is a REST API specification developed by Microsoft. There was also GData that is a now deprecated competitor. There is also JSON API which is work-in-progress driven by the Rails/Ember community. I think they all represent best practices, but none of them are widely accepted standards unless you’re working with specific technologies.

While self describing protocols are cool, good documentation will serve everybody’s needs.

Oh thanks @wrenoud

Right now there is only one request which is for scanning data. There will never been an API for giving orders for ships and fleets because I don’t bots playing in games where other players expect humans they can negotiate with.

I will try and make the fixes I want to make next week then document the request.

Would you ever consider allowing this (and therefore having an API for it) as an option in user created games (and then making it clear before the game starts so there’s no surprises)?

My main motivation for this is that AI in NP was a fact of life when I last played last year (been too busy to play lately unfortunately, but hope to be back soon!) and the built in AI was never particularly good. This is especially painful in the late game for large games, or the poor unfortunate person whose neighbours all quit early. Having an API in games that allow this won’t solve this, of course, but it does mean people could at least try (I’d certainly be interested in it) and maybe someone will come up with something worthwhile.

A secondary motivation is that it could be a great metagame. It certainly would keep me coming back more regularly than I have done. Obviously this isn’t the point of the game, so of course I understand if this isn’t something you’re interested in. More an aside to the previous point.

Now, I haven’t tried out the new AI mentioned here Smarter AI yet, nor have I seen any other changes you may have made since I last played, so maybe all of the above is moot now, in which case maybe ignore me :smile: I’ll hopefully find out soon for myself.

Hey @Fleck, I think I have exactly what you need. A querying API for accessing public game data. You don’t have to deploy/configure/do anything, just look here. It’s harmless as it shows exactly what one would see when watching someone else’s game.

Hey @rubberband I didnt mean to ignore you when you posed a few weeks ago.

Its not completely crazy that we have some kind of “metagame” of building and AI for the game, and it would be fun to perhaps even incorporate it into the main game.

Imagine a small group of programmers all build and AI for the game, and when a player drop Triton chooses an AI to take over. Triton could call a third part service to request and AI “think”. At the end of the game players could vote on if the AI was fun to play against!

3 Likes

No worries!

I’ll look forward to it if you decide to incorporate it in some way. In the meantime, is there any word on the data API? I would love access but can’t find much on the forums (except Qwerty’s API; although I’d like to be able to access my own star information too).

It’s possible to enter username and password, it’s using a dummy account after all, but I didn’t expose this feature publicly so people don’t think I want to steal from them. If you want I will write you in a PM how to do that, but you must sign two copies, one black on white and second inverted, that you understand that you are giving your credentials to a script hosted on my server.

Thinking of that, it would be great if there were two passwords for one account, the other one would be for teammates or friends with limited functionality, so you could only make turns, but not: join/leave games, change user details, buy badges…

PS: using real credentials, it’s, of course, possible to read one’s ships and tech information as well :blush:, heck it’s also possible to read messages and notifications.
It’s read only though.

I see you can now generate API keys - is there documentation for this anywhere? I’d love to play around with this!

Hope a bump is OK on this thread.

I’d also be interested in seeing some API documentation, but couldn’t find a more recent thread with anything in… not even full documentation, maybe just some example endpoints and parameters, am sure I can work out most of the rest for myself…

Also the option to allow orders to be given via the API, and an option to allow “AIs” in user created games would be great. With enough people interested, you may end up with “all AI” games competing to see who has the strongest AI…

R

IIRC, somewhere in the forums, Jay has said that he does not want bots to play the game.
So all playing and clicking should be manual.

So I think that means it should be OK to use a remote presence to do mouse clicks. HA HA !!

You might find this unofficial summary useful: neptunesfolly/api.txt at master · ekimekim/neptunesfolly · GitHub

He leaves out how to login which looks like this if you’re using Python:

login_req = requests.post(
    'http://triton.ironhelmet.com/arequest/login',
    data={
        'type': 'login',
        'alias': 'myusername',
        'password': 'mypassword'
    }
)

To get galaxy data use the cookies from the above request:

galaxy_req = requests.post(
    'http://triton.ironhelmet.com/grequest/order', 
    data={
        'type': 'order', 
        'order': 'full_universe_report', 
        'version': '7', 
        'game_number': '123456789'
    }, 
    cookies=login_req.cookies
)

Wow, you guys are doing amazing stuff, I really wish I had some time to help with this, and infact I will make time soon.

I’m just really focused on Blight right now because if it can be a success I can stay in business and won’t have to go get a real job. If Blight crashes and burns I’ll be in a bit of trouble so I’m super focused on trying to make it good right now.

Real jobs suck, take it from me. Keep living the dream!

Thanks all, very helpful!

Hey all, anyone make any progress on using Neptune’s Pride API? I’d love to build a tool to track and publish game stats, especially a Civ-style time lapse for the map. Not finding much info about how to grab this data though.

@JayKyburz are there any plans of documenting this? Even in a very rudimentary way (where to pass the token: eg query string, post variable, HTTP bearer token? And the endpoint names, I can find the actual format of data returned through trial and error). I would still really really like an easy way of retrieving either my own data or the public data.

Sorry @rubberband I have been meaning to do this. I wanted to set up a proper system so I could track how much activity is being used this way before opening it up to everybody.

Just want to make sure that my servers dont get hammered by accident and I end up with a big bill each month.

What I will probably do is have some way to generate an API key that is sent along with the data, then limit how many API calls can be made per day or per hour or something.

This API seems to no longer be working. All I get now is:

HTTP response status code 302: URL redirection