NATION

PASSWORD

NationStates API (nationdata/regiondata)

Bug reports, general help, ideas for improvements, and questions about how things are meant to work.

Advertisement

Remove ads

User avatar
The Ice States
GA Secretariat
 
Posts: 3757
Founded: Jun 23, 2022
Corporate Police State

Postby The Ice States » Sun Jun 30, 2024 8:54 pm

Could a shard be added to get data only for a specific WA proposal, as opposed to having to query the entire queue for that chamber? For context this is per a discussion a few days ago in the NS Coders server.
Guides to the General Assembly · GA Resolution Stat Effects · Festering Snakepit Wiki · WACampaign

Factbooks · WA Authorships · Nation map


"Petty tyrant", "antithetical to a better future for the WA". Posts in the WA forums are Ooc and unofficial, unless indicated otherwise.

User avatar
Trotterdam
Postmaster-General
 
Posts: 10722
Founded: Jan 12, 2012
Left-Leaning College State

Postby Trotterdam » Sun Jul 28, 2024 10:48 am

It would appear that attempting to check happenings on a nation that was deleted by the moderators causes things to glitch out.

https://www.nationstates.net/cgi-bin/api.cgi?q=happenings&filter=law+member&limit=2&sinceid=187337925&view=nation.hitlers_empire gives:
<WORLD>
<HAPPENINGS><div class"error">System Error (eval) at Sun Jul 28 10:39:51 2024.</div></HAPPENINGS>
</WORLD>

Note that this is not actually the nation API, but rather the world API happenings feed, filtered to one nation. Accessing the nation API gives a 404 code, as expected.

For data-gathering purposes, I would ideally expect deleted nations to still show events that happened up until the moment they got deleted, but failing that, just blanking their happenings list probably works too. A "System Error (eval)" is never a good thing.

User avatar
United Calanworie
Technical Moderator
 
Posts: 5011
Founded: Dec 12, 2018
Democratic Socialists

Postby United Calanworie » Mon Jul 29, 2024 4:30 am

The moderator who deleted that nation actually purged the happenings feed for it at the time of its deletion, which is why the API call resulted in a System Error (eval). Low priority/wontfix because the goal of purging happenings is to, well, purge happenings, inc. the API. It's not really worth the time to fix that sort of bug when a) it happens very rarely and b) the end goal for the case in which it occurs happens appropriately.
Last edited by United Calanworie on Mon Jul 29, 2024 4:31 am, edited 1 time in total.

User avatar
9003
Diplomat
 
Posts: 652
Founded: Oct 25, 2012
Corporate Police State

Postby 9003 » Tue Aug 06, 2024 9:17 am

could the total MV of a collection be added to the collection API shard?

https://www.nationstates.net/cgi-bin/ap ... ectionid=1

right now that data can be grabbed from https://www.nationstates.net/page=deck/ ... lue_deck=1 but if it can be made easier on the system by using the API it def makes it easier on my end.
proud member of PETZ people for the Ethical Treatment of Zombies

Active member of The cards market place discord

User avatar
United Calanworie
Technical Moderator
 
Posts: 5011
Founded: Dec 12, 2018
Democratic Socialists

Postby United Calanworie » Wed Nov 06, 2024 3:14 pm

I am pleased to note that after accidentally setting the servers on fire, we now have a few API improvements:
1) A shard to query the governor title of a region: https://www.nationstates.net/cgi-bin/ap ... ernortitle
2) nation influence *numbers* added to the API *and* the daily dump: https://www.nationstates.net/cgi-bin/ap ... fluencenum
3) A shard to query authorized recruiters for a region: https://www.nationstates.net/cgi-bin/ap ... recruiters
4) Documentation of all of the above, plus the rmbpost private command

User avatar
9003
Diplomat
 
Posts: 652
Founded: Oct 25, 2012
Corporate Police State

Postby 9003 » Sat Nov 16, 2024 11:28 am

Can we add the Market value of a card to the collections shard? It would be nice and allow me to simulate pulling packs for statistical analysis better.

<CARD>
<CARDID>1</CARDID>
<CATEGORY>legendary</CATEGORY>
<SEASON>1</SEASON>
<MARKET_VALUE>100</MARKET_VALUE>
</CARD>

Highest bid lowest ask could also be nice but lesser so.
proud member of PETZ people for the Ethical Treatment of Zombies

Active member of The cards market place discord

User avatar
UPC
Bureaucrat
 
Posts: 48
Founded: Jul 18, 2022
Liberal Democratic Socialists

Postby UPC » Mon Nov 18, 2024 6:03 am

Could the magnetism value for regions be added to the region daily dump?
The Mind-Killer of UPC
President & Delegate of Europeia

(he/they)
Visit Europeia | Join Our Discord | Apply For Citizenship

User avatar
New Rogernomics
Powerbroker
 
Posts: 9532
Founded: Aug 22, 2006
Civil Rights Lovefest

Postby New Rogernomics » Wed Nov 20, 2024 1:54 am

New to using php scripts with the nationstates daily dump.

It downloads the nations.xml.gz on the 1st of each month and takes the specific WA's endorsing the Delegate and organizes them by how many endorsements they have.
Last edited by New Rogernomics on Wed Nov 20, 2024 10:25 pm, edited 1 time in total.
Eldarion Mystifur
Herald (Vice-Delegate) of Lazarus
For Axios! For Lazarus! For the Union of Three!
  • Former First Citizen (PM) of Lazarus
  • Former Minister of Foreign Affairs of Lazarus
  • Former Lazarus Delegate (Humane Republic of Lazarus, 2015)
  • Minister of Culture & Media (Humane Republic of Lazarus)
  • Interior Commissioner of Lazarus (Pre-People's Republic of Lazarus)
  • ADN:DSA Rep for Eastern Roman Empire
  • Honoratus Servant of the Holy Land (Eastern Roman Empire)

User avatar
Trotterdam
Postmaster-General
 
Posts: 10722
Founded: Jan 12, 2012
Left-Leaning College State

Postby Trotterdam » Wed Nov 20, 2024 3:24 am

New Rogernomics wrote:Is this compliant with rate limits, before I take it beyond a testing stage:
It is not the duty of the NationStates admins to pore over your code and figure out what it does. Complying with the ratelimits is your own responsibility.

However, I would say that as the nations.xml.gz file is only updated once a day, you should not usually attempt to download it more than once a day, which should be a pretty simple rule to follow, and is so slow that the ratelimit rules that apply to the rest of the API are irrelevant. If you try to download it but fail due to a server/network error, then trying again after a short time is probably fine.

However, I am not site staff, so this is not a binding ruling of any sort.

User avatar
New Rogernomics
Powerbroker
 
Posts: 9532
Founded: Aug 22, 2006
Civil Rights Lovefest

Postby New Rogernomics » Wed Nov 20, 2024 9:26 am

Trotterdam wrote:
New Rogernomics wrote:Is this compliant with rate limits, before I take it beyond a testing stage:
It is not the duty of the NationStates admins to pore over your code and figure out what it does. Complying with the ratelimits is your own responsibility.

However, I would say that as the nations.xml.gz file is only updated once a day, you should not usually attempt to download it more than once a day, which should be a pretty simple rule to follow, and is so slow that the ratelimit rules that apply to the rest of the API are irrelevant. If you try to download it but fail due to a server/network error, then trying again after a short time is probably fine.

However, I am not site staff, so this is not a binding ruling of any sort.
I wouldn’t present something I didn’t already believe was compliant. I posted here out of common courtesy because in the past some things can skirt the rules. So a bit of a harsh response to something equivalent of, “I’m doing this, we cool?”

Since my code only takes it once a month, this is not going to be something that really bothers things.
Eldarion Mystifur
Herald (Vice-Delegate) of Lazarus
For Axios! For Lazarus! For the Union of Three!
  • Former First Citizen (PM) of Lazarus
  • Former Minister of Foreign Affairs of Lazarus
  • Former Lazarus Delegate (Humane Republic of Lazarus, 2015)
  • Minister of Culture & Media (Humane Republic of Lazarus)
  • Interior Commissioner of Lazarus (Pre-People's Republic of Lazarus)
  • ADN:DSA Rep for Eastern Roman Empire
  • Honoratus Servant of the Holy Land (Eastern Roman Empire)

User avatar
Refuge Isle
Technical Moderator
 
Posts: 2435
Founded: Dec 14, 2018
Left-wing Utopia

Postby Refuge Isle » Wed Nov 20, 2024 4:11 pm

Trotterdam wrote:It is not the duty of the NationStates admins to pore over your code and figure out what it does. Complying with the ratelimits is your own responsibility.
New Rogernomics wrote:I wouldn’t present something I didn’t already believe was compliant. I posted here out of common courtesy because in the past some things can skirt the rules. So a bit of a harsh response to something equivalent of, “I’m doing this, we cool?”

Mmn, the thing you're asking is no different than what Trotterdam is saying you're asking. Because if we give a response of "cool" or "not cool", we are effectively having to look at your code to determine and report its legality. That's not a service we provide, and it works a lot like asking hypotheticals in the Moderation board. We can look at something out of context and say "go for it", but there's no real guarantee that we can guess how it will adjust later on, or how it will change when being applied to a context we're not expecting.

What I'll say is that if you're pulling a singular page or file one time in a month, that works with any rate limit (including hitting the html site).

User avatar
New Rogernomics
Powerbroker
 
Posts: 9532
Founded: Aug 22, 2006
Civil Rights Lovefest

Postby New Rogernomics » Wed Nov 20, 2024 4:51 pm

Refuge Isle wrote:
Trotterdam wrote:It is not the duty of the NationStates admins to pore over your code and figure out what it does. Complying with the ratelimits is your own responsibility.
New Rogernomics wrote:I wouldn’t present something I didn’t already believe was compliant. I posted here out of common courtesy because in the past some things can skirt the rules. So a bit of a harsh response to something equivalent of, “I’m doing this, we cool?”

Mmn, the thing you're asking is no different than what Trotterdam is saying you're asking. Because if we give a response of "cool" or "not cool", we are effectively having to look at your code to determine and report its legality. That's not a service we provide, and it works a lot like asking hypotheticals in the Moderation board. We can look at something out of context and say "go for it", but there's no real guarantee that we can guess how it will adjust later on, or how it will change when being applied to a context we're not expecting.

What I'll say is that if you're pulling a singular page or file one time in a month, that works with any rate limit (including hitting the html site).
Well, I was more referring to Predator, and similar such stuff, where there was an admin review of the code, and in those instances it does become your job.

This implementation though is something others have done already probably, taking the daily data dump to run an endorsement campaign dispatch.
Eldarion Mystifur
Herald (Vice-Delegate) of Lazarus
For Axios! For Lazarus! For the Union of Three!
  • Former First Citizen (PM) of Lazarus
  • Former Minister of Foreign Affairs of Lazarus
  • Former Lazarus Delegate (Humane Republic of Lazarus, 2015)
  • Minister of Culture & Media (Humane Republic of Lazarus)
  • Interior Commissioner of Lazarus (Pre-People's Republic of Lazarus)
  • ADN:DSA Rep for Eastern Roman Empire
  • Honoratus Servant of the Holy Land (Eastern Roman Empire)

User avatar
United Calanworie
Technical Moderator
 
Posts: 5011
Founded: Dec 12, 2018
Democratic Socialists

Postby United Calanworie » Wed Nov 20, 2024 5:22 pm

New Rogernomics wrote:
Refuge Isle wrote:Mmn, the thing you're asking is no different than what Trotterdam is saying you're asking. Because if we give a response of "cool" or "not cool", we are effectively having to look at your code to determine and report its legality. That's not a service we provide, and it works a lot like asking hypotheticals in the Moderation board. We can look at something out of context and say "go for it", but there's no real guarantee that we can guess how it will adjust later on, or how it will change when being applied to a context we're not expecting.

What I'll say is that if you're pulling a singular page or file one time in a month, that works with any rate limit (including hitting the html site).
Well, I was more referring to Predator, and similar such stuff, where there was an admin review of the code, and in those instances it does become your job.

This implementation though is something others have done already probably, taking the daily data dump to run an endorsement campaign dispatch.

Predator resulted in an admin review of code *because* it was *illegal,* not to determine if it was legal or not on a whim. Luca's response here is excellent, but I will also tag on that if we start reviewing code that gets posted here and give it a thumbs-up/thumbs-down, we would be inundated in requests for such review. We do not have the capacity to do that.

User avatar
Trotterdam
Postmaster-General
 
Posts: 10722
Founded: Jan 12, 2012
Left-Leaning College State

Postby Trotterdam » Wed Nov 20, 2024 6:09 pm

Also, understanding other people's code (or, heck, your own code when you haven't looked at it for a few months) is difficult, and it's easy to think at first glance that the code looks fine, only for it to turn out to have a hidden problem later (maybe a mistake, maybe even deliberately obfuscated). Even if you're willing to give the code a cursory look, it's risky to say "this is okay" in a way that might be construed as a binding agreement.

User avatar
New Rogernomics
Powerbroker
 
Posts: 9532
Founded: Aug 22, 2006
Civil Rights Lovefest

Postby New Rogernomics » Wed Nov 20, 2024 6:25 pm

Trotterdam wrote:Also, understanding other people's code (or, heck, your own code when you haven't looked at it for a few months) is difficult, and it's easy to think at first glance that the code looks fine, only for it to turn out to have a hidden problem later (maybe a mistake, maybe even deliberately obfuscated). Even if you're willing to give the code a cursory look, it's risky to say "this is okay" in a way that might be construed as a binding agreement.
I get that. Anything I do code project wise I put up on github eventually and do documentation on, so that months later if I come back to it, I don't pull my hair out trying to figure out what I did.
Eldarion Mystifur
Herald (Vice-Delegate) of Lazarus
For Axios! For Lazarus! For the Union of Three!
  • Former First Citizen (PM) of Lazarus
  • Former Minister of Foreign Affairs of Lazarus
  • Former Lazarus Delegate (Humane Republic of Lazarus, 2015)
  • Minister of Culture & Media (Humane Republic of Lazarus)
  • Interior Commissioner of Lazarus (Pre-People's Republic of Lazarus)
  • ADN:DSA Rep for Eastern Roman Empire
  • Honoratus Servant of the Holy Land (Eastern Roman Empire)

User avatar
Kractero
Negotiator
 
Posts: 5218
Founded: May 08, 2011
Capitalist Paradise

Postby Kractero » Wed Nov 20, 2024 6:29 pm

I believe the issues shard is returning malformed xml for issues that contain the warning tags. The warning should be in quotes.

Code: Select all
<ISSUE id="390">
<TITLE>An Unstable Situation</TITLE>
<CHAIN>An International Incident</CHAIN>
<RECAP>Your government’s response to overtures of aggression from the Brasilistanis has been to march the University of Toledoan army in and take out the tyrannical and violent government.</RECAP>
<TEXT>The “intervention” into Brasilistan has largely been a success, but now the nation has devolved into anarchy with no functioning government. International allies and observers are concerned and have asked that University of Toledo clean up the mess it made.</TEXT>
<AUTHOR>sanctaria</AUTHOR>
<EDITOR>sanctaria</EDITOR>
<PIC1>c11</PIC1>
<PIC2>d12</PIC2>
<OPTION id="0">removed for length purposes</OPTION>
<OPTION id="1">removed for length purpose</OPTION>
<WARNING id=-1>Warning: this issue is part of a non-repeatable chain. Dismissing it may permanently lock you out of achieving some banners!</WARNING>
</ISSUE>

User avatar
SherpDaWerp
Admin
 
Posts: 2103
Founded: Mar 02, 2016
Benevolent Dictatorship

Postby SherpDaWerp » Wed Nov 20, 2024 8:42 pm

Kractero wrote:I believe the issues shard is returning malformed xml for issues that contain the warning tags.

Ah, good spot. Now fixed.
NationStates Administrator

Statistical speculation from before 18/01/23 is entirely unofficial

User avatar
Trotterdam
Postmaster-General
 
Posts: 10722
Founded: Jan 12, 2012
Left-Leaning College State

Postby Trotterdam » Wed Nov 20, 2024 8:44 pm

Kractero wrote:I believe the issues shard is returning malformed xml for issues that contain the warning tags. The warning should be in quotes.
Do you mean that the id=-1 should be id="-1"? The warning itself looks fine.

User avatar
Kractero
Negotiator
 
Posts: 5218
Founded: May 08, 2011
Capitalist Paradise

Postby Kractero » Wed Nov 20, 2024 9:26 pm

Trotterdam wrote:
Kractero wrote:I believe the issues shard is returning malformed xml for issues that contain the warning tags. The warning should be in quotes.
Do you mean that the id=-1 should be id="-1"? The warning itself looks fine.

Yes

User avatar
Flanderlion
Minister
 
Posts: 2243
Founded: Nov 25, 2013
Psychotic Dictatorship

Postby Flanderlion » Fri Nov 29, 2024 1:30 am

SherpDaWerp wrote:
Kractero wrote:I believe the issues shard is returning malformed xml for issues that contain the warning tags.

Ah, good spot. Now fixed.

Thanks, both for the fix and for @Kractero for reporting it. Was super annoying having to manually answer those ones, and I was too lazy to fix it 'as it's only 1 issue', but it's multiplied so many times that it would've been far more efficient to have reworked my script ages ago.
As always, I'm representing myself.
Information
Wishlist

User avatar
Vleerian
Spokesperson
 
Posts: 182
Founded: Feb 07, 2022
Capitalist Paradise

Postby Vleerian » Sun Dec 01, 2024 11:05 am

Vleerian wrote:Also, could an API endpoint be added that provides the most recent trading card season? Something like
https://www.nationstates.net/cgi-bin/ap ... cardseason
Code: Select all
<CARDS>
  <CARDSEASON>3</CARDSEASON>
</CARDS>

It would help immensely in future-proofing scripts that work with the cards API, especially where a script has to download and digest the cards data dumps on their first run.

With a potential fourth season of cards on the horizon, I'd like to ask for this once again
Vleerian - Also known as Aurum Rider
Creator of FATTKatt and zoomies, Author of The Bacchist Manifesto
Designer of many Malice logos, headers, and flags. Certified Ruffian

User avatar
Riemstagrad
Ambassador
 
Posts: 1149
Founded: Antiquity
Left-Leaning College State

Postby Riemstagrad » Fri Dec 06, 2024 2:01 am

Request: An API shard to track the easter eggs a nation allready has.

Today it is not possible to track wich easter eggs you allready found, although it is obvious that the game somehow keeps track of this.

So: An API shard that returns the corresponding issue numbers of the eggs that a nation found would be a nice thing to have.

User avatar
SherpDaWerp
Admin
 
Posts: 2103
Founded: Mar 02, 2016
Benevolent Dictatorship

Postby SherpDaWerp » Fri Dec 06, 2024 2:33 am

Riemstagrad wrote:Request: An API shard to track the easter eggs a nation allready has.

Today it is not possible to track wich easter eggs you allready found, although it is obvious that the game somehow keeps track of this.

So: An API shard that returns the corresponding issue numbers of the eggs that a nation found would be a nice thing to have.

This is surprisingly tricky, for a variety of reasons.

If you want the number, sure, we do already store that and display it for the nation badge. However, we had a bug in the past where #625 (I think that's the right ID) was repeatable, which led to (highly rare, but still out there) inflated scores, and I would want to fix that before we make people's easter egg scores more accessible. Doing a pass over all nations to fix this is decidedly non-trivial.

If you want the actual issues, sure, but the backend method of tracking which eggs you've answered doesn't lend itself easily to an extensible "list which egg issues I have answered" call. Keyword extensible - it's doable now, but only in a way that creates more pitfalls for the future creation of easter eggs, which we would like to avoid. So that's also non-trivial.

That is to say, easter egg tracking is on my list, but it's not particularly close to the top.
NationStates Administrator

Statistical speculation from before 18/01/23 is entirely unofficial

User avatar
Kractero
Negotiator
 
Posts: 5218
Founded: May 08, 2011
Capitalist Paradise

Postby Kractero » Sat Dec 07, 2024 2:20 am

Riemstagrad wrote:Request: An API shard to track the easter eggs a nation allready has.

Today it is not possible to track wich easter eggs you allready found, although it is obvious that the game somehow keeps track of this.

So: An API shard that returns the corresponding issue numbers of the eggs that a nation found would be a nice thing to have.

I think this would be a good idea, especially for older nations or just for anyone who forgot to track the eggs they received (like I have no idea if I got the christmas eggs or which 3 I have left)

Previous

Advertisement

Remove ads

Return to Technical

Who is online

Users browsing this forum: Cappanoole, Cyzon Galactic

Advertisement

Remove ads

cron