Jump to content
Game-Labs Forum
raskolnikoff

Public "API" for Naval Action

Recommended Posts

Hi,

Is there in the data a way to know the ports where there is a PB?

I can see PortBattleStartTime, LastPortBattle but "Contested" is always "-1"...

Share this post


Link to post
Share on other sites

 

 

Does the API address this suggestion I posted about the economy? 

And is there a currently functioning website somewhere that reads the economic data?

Or can a non-coder (me) read the data directly and manipulate it in a spreadsheet?

This is a big issue on the PvE server.  The population is low enough in my time zone that clans aren't going to provide a workaround.

Share this post


Link to post
Share on other sites
On 15.02.2018 at 2:57 PM, Marcus Valerius Corvus said:

Does the API address this suggestion I posted about the economy? 

And is there a currently functioning website somewhere that reads the economic data?

Or can a non-coder (me) read the data directly and manipulate it in a spreadsheet?

This is a big issue on the PvE server.  The population is low enough in my time zone that clans aren't going to provide a workaround.

1. API provides:
- Item in each shop
- sale price / sale quantity - so if someone is selling through contract it will show that price and the contracts quantity, the same for the NPC sale
- buy price / buy quantity - so if the NPC store would buy any ammount of the item the price would be set, if that's a contact it would show how many items would that be
- biggest issue on this is the fact the data is provided at maintenance time, and it is not updated during day time

2. From what i know there is no "working" website.

3. Yes, it is possible to parse the API data to identify items sold/bought. I'm doing that myself. ;) (greedy bastard mode) 

Share this post


Link to post
Share on other sites
8 hours ago, Darayavahus said:

1. API provides:
- Item in each shop
- sale price / sale quantity - so if someone is selling through contract it will show that price and the contracts quantity, the same for the NPC sale
- buy price / buy quantity - so if the NPC store would buy any ammount of the item the price would be set, if that's a contact it would show how many items would that be
- biggest issue on this is the fact the data is provided at maintenance time, and it is not updated during day time

2. From what i know there is no "working" website.

3. Yes, it is possible to parse the API data to identify items sold/bought. I'm doing that myself. ;) (greedy bastard mode) 

That contract data is precisely what I am after.  The shop screen at Navalactioncraft looks like it was supposed to do this (at least in part) but appears to have had no updates since last summer.  Seems a bit erratic in how accurate and what exactly gets posted.

What are you loading the API data into to parse it?

I tried a couple things that were supposed to read the json file and output a table but couldn't get them to work.  But I really have NO idea what I am doing.

 

Share this post


Link to post
Share on other sites
On 3/2/2018 at 7:45 AM, Darayavahus said:

Txt file :D then i use Authotkey macro that looks for certain items i described in excel sheet which is my final output aswell.

Will try that.  I originally was trying to use the pastebin file in the original post and I couldn't get it to load.  I am guessing it is stale javascript that my browser doesn't like.

Share this post


Link to post
Share on other sites
On 3/3/2018 at 11:12 AM, Marcus Corvus said:

Will try that.  I originally was trying to use the pastebin file in the original post and I couldn't get it to load.  I am guessing it is stale javascript that my browser doesn't like.

And I find that I don't have time to fiddle with this as a casual player.  Sailing, crafting, combat and trading all take time.  I have to focus on something.  In my case that is trading IN-GAME.  This needs to be either a packaged tool I can download and run without modification, an easily manipulated delimited file, or packaged inside the trader tool where the player contract data belongs.

Share this post


Link to post
Share on other sites
23 hours ago, Marcus Corvus said:

And I find that I don't have time to fiddle with this as a casual player.  Sailing, crafting, combat and trading all take time.  I have to focus on something.  In my case that is trading IN-GAME.  This needs to be either a packaged tool I can download and run without modification, an easily manipulated delimited file, or packaged inside the trader tool where the player contract data belongs.

It is a delimited text file, as XML is highly structured in fact, but just more flexible in the type of data structures it can contain than more common, "flat" structures. 

The links of the OP are accurate as of server reset. We'll likely never see a true API to the live data because of the server overhead and the fact that providing this data is probably low priority. 

Share this post


Link to post
Share on other sites
7 hours ago, Wraith said:

It is a delimited text file, as XML is highly structured in fact, but just more flexible in the type of data structures it can contain than more common, "flat" structures. 

The links of the OP are accurate as of server reset. We'll likely never see a true API to the live data because of the server overhead and the fact that providing this data is probably low priority. 

I get that it is not going to be live data.  My issue is that I can't figure out how to get it into a form I can work with without creating a huge daily chore.

Since I am settling down to something to something in the neighborhood of six hours a week for the game it's time to cut the lines and move on.

Share this post


Link to post
Share on other sites
On 4/13/2018 at 3:57 PM, Marcus Corvus said:

I get that it is not going to be live data.  My issue is that I can't figure out how to get it into a form I can work with without creating a huge daily chore.

Since I am settling down to something to something in the neighborhood of six hours a week for the game it's time to cut the lines and move on.

https://nicktestxyz.com/na_cache/

I'll be working on eco data next.

BTW this is a temporary solution/test version.  

Share this post


Link to post
Share on other sites
30 minutes ago, Jean Ribault said:

Pretty cool stuff.  However, your column sorting does not seem to be working correctly.  Was I doing something wrong?

filter just removes the unmatched entries from the main dump, columns should sort if you click on them. There's some weirdness with that grid I'm using though so I wouldn't be shocked if something was bugged. I had to remove currency symbols before for it to sort the gold correctly. Just a test for now I may not even use that grid in the final version because of its odd ins and outs.

Edited by koiz

Share this post


Link to post
Share on other sites

Is there an error in Nation.json? Because I am trying to parse it in C++ with the Qt json classes and all but nation work... in nation I get this error: "garbage at the end of the document".

Also your api is not really json... it is json wrapped in java script so in c++ you need to filter the lead and the end out. Would somewhat be nice if you would provide pure json data without the java script heading...

 

Share this post


Link to post
Share on other sites
20 minutes ago, John Hood said:

Is there an error in Nation.json? Because I am trying to parse it in C++ with the Qt json classes and all but nation work... in nation I get this error: "garbage at the end of the document".

Also your api is not really json... it is json wrapped in java script so in c++ you need to filter the lead and the end out. Would somewhat be nice if you would provide pure json data without the java script heading...

 

Delete in beginning var Nations = and in the end ;

Your proposal the author of topic will not see. Look at his last visited time and last message.

 
Edited by qw569

Share this post


Link to post
Share on other sites
28 minutes ago, qw569 said:

Delete in beginning var Nations = and in the end ;

Your proposal the author of topic will not see. Look at his last visited time and last message.



 

I do that for all the others... for Nations it somehow does not work...

Share this post


Link to post
Share on other sites

I found the bug... a stupid mistake with stripping out the java script that I guess they need for jsonp... instead of looking for the equal I started to strip at the { and well Nations as only one uses a [... kinda easy to overlook but clearly my mistake :)

 

https://jsonformatter.curiousconcept.com/ this link helped me to find it because well it looks much better then looking at it in chrome...

Edited by John Hood

Share this post


Link to post
Share on other sites

@DaRho

I check sha256 of both files and don't see difference.

curl 'http://storage.googleapis.com/nacleanopenworldprodshards/Ports_cleanopenworldprodeu1.json' | sha256sum
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  830k  100  830k    0     0   9.9M      0 --:--:-- --:--:-- --:--:-- 10.0M
42b325be07bda30b6ae60fd0ed97033cab40da7d4c5a85e2eea641c7dc174749  -
curl 'https://storage.googleapis.com/nacleanopenworldprodshards/Ports_cleanopenworldprodeu1.json' | sha256sum
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  830k  100  830k    0     0  18.4M      0 --:--:-- --:--:-- --:--:-- 18.8M
42b325be07bda30b6ae60fd0ed97033cab40da7d4c5a85e2eea641c7dc174749  -

btw You always can check if file updated or not by HTTP headers like  Last-Modified, x-goog-hash and Etag.

 

curl -I 'https://storage.googleapis.com/nacleanopenworldprodshards/Ports_cleanopenworldprodeu1.json'
HTTP/1.1 200 OK
X-GUploader-UploadID: AEnB2UoMcLeJGTB44mPSO2incD2rjDLycNX1Pze_n3R0pkpyyEgzzbxbdESLJQNFrKlijbwH9Y3_PCHmGVvVvWFgvYS9Z50aCA
Date: Fri, 31 Aug 2018 11:50:50 GMT
Expires: Fri, 31 Aug 2018 15:50:50 GMT
Last-Modified: Fri, 31 Aug 2018 10:20:26 GMT
ETag: "64d192ae2adf25362cbe19b0281e5724"
x-goog-generation: 1535710826390446
x-goog-metageneration: 1
x-goog-stored-content-encoding: identity
x-goog-stored-content-length: 850198
Content-Type: text/plain
x-goog-hash: crc32c=OEkE/g==
x-goog-hash: md5=ZNGSrirfJTYsvhmwKB5XJA==

x-goog-storage-class: STANDARD
Accept-Ranges: bytes
Content-Length: 850198
Server: UploadServer
Cache-Control: max-age=14400
Age: 1208
Alt-Svc: quic=":443"; ma=2592000; v="44,43,39,35"

Edited by qw569
  • Like 1

Share this post


Link to post
Share on other sites

Quite strange... I checked again a moment ago, and could see differences with my bare eyes. Then used some online comparison tool for URLs (https://www.diffnow.com/) and it has shown no differences... refreshed the pages in browser again, and now they're the same... very odd. Perhaps some cache issue or something. However I checked that on few PCs at my home at the issue was on all of them, now it's gone... Anyway - thanks for the reply. BTW. Did never consider to check the headers to see if the data was updated already. Good idea. Thanks.

Share this post


Link to post
Share on other sites
14 minutes ago, DaRho said:

Quite strange... I checked again a moment ago, and could see differences with my bare eyes. Then used some online comparison tool for URLs (https://www.diffnow.com/) and it has shown no differences... refreshed the pages in browser again, and now they're the same... very odd. Perhaps some cache issue or something. However I checked that on few PCs at my home at the issue was on all of them, now it's gone... Anyway - thanks for the reply. BTW. Did never consider to check the headers to see if the data was updated already. Good idea. Thanks.

There is a special type of HTTP request HEAD which return only HTTP headers. In my example i use curl with parameter -I

Edited by qw569

Share this post


Link to post
Share on other sites

Yup. I'm familiar with the HTTP headers, it just didn't occur to me to use them to check if the data has been updated already :) very useful thing to know ;) Thanks

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×