Mored Posted March 31, 2016 Posted March 31, 2016 Ok, I've found the issue - part of the data is not being exported. I will fix this in a next couple of weeks (most likely with a next content patch) Sorry for messing things up Today was a patch with new content, so may i asked if this will be updated also?
raskolnikoff Posted March 31, 2016 Author Posted March 31, 2016 Today was a patch with new content, so may i asked if this will be updated also? Not yet.. Sorry Next update will contain API update - more data available in Item Templates (full data about item templates) and UTF8 support It should arrive with a next big update (from 10th to 15th of April) 1
Mored Posted March 31, 2016 Posted March 31, 2016 Thx a lot for the information and of course for your extra work to make it possible
Svartschegg Posted April 3, 2016 Posted April 3, 2016 Not yet.. Sorry Next update will contain API update - more data available in Item Templates (full data about item templates) and UTF8 support It should arrive with a next big update (from 10th to 15th of April) Will the new API overwrite the existing data sources, or will it be backward-compatible?
Svartschegg Posted April 3, 2016 Posted April 3, 2016 (edited) Indeed... Here is a quick PHP function to transform this javascript declaration into proper JSON returns null if something is wrong, or a PHP array containing datas from the "API" function fetchEndpoint($endpointUrl) { $content = file_get_contents($endpointUrl); if($content!==null && is_string($content)) { $equalPos = strpos($content, '='); if($equalPos!==false) $content = trim(print_r(substr($content, $equalPos+1), true), ' ;'); $JSON = json_decode($content,1); return $JSON; } return null; } Nice! Since we're in a sharing-is-caring mood I implemented your function into an implicit Laravel controller Edit: Made it a Gist instead of pasting it all here. https://gist.github.com/Sleavely/945939aec743ebe1b54ddc89b861493b Edited April 3, 2016 by Svartschegg
raskolnikoff Posted April 3, 2016 Author Posted April 3, 2016 Will the new API overwrite the existing data sources, or will it be backward-compatible? it will replace data, but will be backward-compatible
Migui Posted April 4, 2016 Posted April 4, 2016 I'd love to see a public/private api key to fetch player name/clan/nation like in EVE, to be used as an authentication factor in 3rd apps.
woodenfish Posted April 4, 2016 Posted April 4, 2016 Will the new api include whether a port is shallow or deep in the ports file? Or is that there already and I'm just not seeing it?
Svartschegg Posted April 4, 2016 Posted April 4, 2016 I'd love to see a public/private api key to fetch player name/clan/nation like in EVE, to be used as an authentication factor in 3rd apps.+1 Would love to have a Steam-based auth for logging in as your in-game character on clan forums and stuff.
woodenfish Posted April 4, 2016 Posted April 4, 2016 +1 Would love to have a Steam-based auth for logging in as your in-game character on clan forums and stuff. http://stackoverflow.com/questions/18674042/steam-api-authentication might be what you are looing for?
Ponk Posted April 4, 2016 Posted April 4, 2016 +1 Would love to have a Steam-based auth for logging in as your in-game character on clan forums and stuff. +1 Yeah that would be nice, that would make all the polls about the direction the game should take in development become more trustworthy, I would for example love to see how many votes or voters on the "Player ship selection 1st half 2016 - Final Poll" comes from the same IP adress.
slik Posted April 4, 2016 Posted April 4, 2016 Will the new api include whether a port is shallow or deep in the ports file? Or is that there already and I'm just not seeing it? Take a look at Depth. 0 - deep 1 - shallow
woodenfish Posted April 4, 2016 Posted April 4, 2016 Take a look at Depth. 0 - deep 1 - shallow D'oh! Thanks.
Crayon Posted April 4, 2016 Posted April 4, 2016 (edited) Hello, I just found this post. Is there currently in game support for plugins? Edit: I would like to make the API here more real time. Is there an API on how to interact with Naval Action client from 3rd party addons? OK with the devs to create 3rd party addons ? Edit2: Aside from experience, do you track user factions per steamID/Account? Edited April 4, 2016 by Crayon
Prater Posted April 4, 2016 Posted April 4, 2016 Hello, I just found this post. Is there currently in game support for plugins? Edit: I would like to make the API here more real time. Is there an API on how to interact with Naval Action client from 3rd party addons? OK with the devs to create 3rd party addons ? Edit2: Aside from experience, do you track user factions per steamID/Account? The api is not real time data but data from the last maintenance.
Crayon Posted April 4, 2016 Posted April 4, 2016 (edited) The api is not real time data but data from the last maintenance. Yeah, I know. In that regard I don't understand why it cant be updated by users though. I could easily create my own database tables, make a simple web app from the given API, and allow updates that way. I think my Uni servers are still available to me... the only thing is I have no reliable, easy way to get the data from the game into a form on the web. Even if I could just copy pasta chars into a form somehow I could get it to work! Edited April 4, 2016 by Crayon
ObiQuiet Posted April 5, 2016 Posted April 5, 2016 Yeah, I know. In that regard I don't understand why it cant be updated by users though. I could easily create my own database tables, make a simple web app from the given API, and allow updates that way. I think my Uni servers are still available to me... the only thing is I have no reliable, easy way to get the data from the game into a form on the web. Even if I could just copy pasta chars into a form somehow I could get it to work! Do that on a separate host that you control. There is a much higher bar for accepting contributions to a central data set... to prevent data poisoning, denial of service, and just plain misinformation.
Svartschegg Posted April 5, 2016 Posted April 5, 2016 (edited) http://stackoverflow.com/questions/18674042/steam-api-authentication might be what you are looing for?Yeah I know how to authenticate with Steam, but Naval Action has a secondary, undocumented, layer of authentication that checks for the Steam token and also allows users to login with a user/pass combination that bypasses Steam. It is that secondary step of authentication that I suppose returns the list of "Captains" in your account. To clarify with an example, my Steam username used to be "John", but my main captain in Naval Action is called "Svartschegg". I would like to retrieve "Svartschegg" from NA rather than "John" from Steam. Edited April 5, 2016 by Svartschegg 1
Crayon Posted April 5, 2016 Posted April 5, 2016 Do that on a separate host that you control. There is a much higher bar for accepting contributions to a central data set... to prevent data poisoning, denial of service, and just plain misinformation. Yeah I understand. It would require two seperate hosts with redundant data behind firewalls, and authentication ofc. Within my skillset, but let me tell ya, I hate double work =\
RaiVeN Posted April 5, 2016 Posted April 5, 2016 Ports ports attacks and leaderboards (if is set in the future) that arent in real time... At least the ports and ports attacks
Mored Posted April 6, 2016 Posted April 6, 2016 database view, export/cache this in a xml and everyone is happy. Split it up in: data that changes frequently - market amounts, prices data that changes only once a day - port ownership data that changes only by patches - blueprint data, metadata of ports
Svartschegg Posted April 6, 2016 Posted April 6, 2016 (edited) Ports ports attacks and leaderboards (if is set in the future) that arent in real time... At least the ports and ports attacks If you're on EU PVP3 you can query https://klr.nu/api/v2/port/{port_id} for a log of conquests. API docs: https://klr.nu/api/v2/docs#portSample response for Scarborough: { "id":165, "nation_id":5, "name":"Scarborough", "capital":false, "regional":false, "shallow":false, "capturer_id":677, "timeslot":-1, "slug":"scarborough", "lat":"11.144213", "lng":"-60.775337", "updated_at":"2016-04-17 08:32:34", "nation":{ "id":5, "name":"Verenigde Provinci\u00ebn", "max_bots":36, "updated_at":"2016-04-13 08:16:17" }, "capturer":{ "id":2, "name":"Svartschegg", "nation_id":7, "clan_id":24, "slug":"svartschegg", "created_at":"2016-01-18 00:00:00", "updated_at":"2016-04-12 13:41:52" }, "production":[ { "item_id":42, "quantity":4, "item":{ "id":42, "name":"Silver", "type":"Resource", "updated_at":"2016-04-24 10:15:47" } } ], "consumption":[ { "item_id":300, "quantity":48, "item":{ "id":300, "name":"Live Oak Log", "type":"Resource", "updated_at":"2016-04-24 10:15:47" } } ], "shop":[ { "item_id":27, "quantity":425, "buy_price":152, "sell_price":76, "contract_buy_quantity":-1, "contract_sell_quantity":-1, "updated_at":"2016-04-24 10:16:18", "item":{ "id":27, "name":"Gold", "type":"Resource", "updated_at":"2016-04-24 10:15:47" } } ], "conquests":[ // 10 latest, regardless of contested (captured) or not { "id":1, "port_id":165, "nation_id"7, "player_id":2, "contested":true, "created_at":"2016-04-06 15:59:32", "updated_at":"2016-04-06 16:49:16", "nation":{ "id":7, "name":"Sverige", "max_bots":36, "updated_at":"2016-04-05 05:53:50" }, "player":{ "id":2, "name":"Svartschegg", "nation_id":null, "clan_id":24, "slug":"svartschegg", "created_at":"2016-01-18 00:00:00", "updated_at":"2016-04-12 13:41:52" } } ] }Edit: API v2 Edited April 26, 2016 by Svartschegg
raskolnikoff Posted April 13, 2016 Author Posted April 13, 2016 API were updated - switched to UTF8 encoding and way more data is available in ItemTemplate's
Svartschegg Posted April 13, 2016 Posted April 13, 2016 API were updated - switched to UTF8 encoding and way more data is available in ItemTemplate's Oooh, nice! Thanks!
Recommended Posts