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
Frisbeeteria
Senior Game Moderator
 
Posts: 27796
Founded: Dec 16, 2003
Capitalizt

Postby Frisbeeteria » Fri Oct 09, 2015 10:45 am

The United Island Tribes wrote:I need a way to ban myself from the api to test and fix how my python module handles api temp bans.

Easy enough. File a GHR from the nation holding an API recruitment key and we can lock you out. If you don't have one, go found a region with a puppet and request one, then explain about the lock testing.

User avatar
The United Island Tribes
Bureaucrat
 
Posts: 48
Founded: Oct 17, 2014
Left-wing Utopia

Postby The United Island Tribes » Fri Oct 09, 2015 11:09 am

Frisbeeteria wrote:
The United Island Tribes wrote:I need a way to ban myself from the api to test and fix how my python module handles api temp bans.

Easy enough. File a GHR from the nation holding an API recruitment key and we can lock you out. If you don't have one, go found a region with a puppet and request one, then explain about the lock testing.


Are you saying my telegram api client_key needs to be locked out? I rather keep one key operation. Am I allowed to have two api keys? (two separate regions of course)

User avatar
Frisbeeteria
Senior Game Moderator
 
Posts: 27796
Founded: Dec 16, 2003
Capitalizt

Postby Frisbeeteria » Fri Oct 09, 2015 11:35 am

The United Island Tribes wrote:Am I allowed to have two api keys? (two separate regions of course)

AFAIK, several people manage recruiting puppets in multiple regions. You are allowed only one API key per region, but there's no rule that says you can't have multiple regions.

User avatar
HMS Unicorn
Spokesperson
 
Posts: 199
Founded: Jun 29, 2005
Ex-Nation

Postby HMS Unicorn » Fri Oct 09, 2015 1:32 pm

HMS Unicorn wrote:Would it be possible to add an option for the Happenings shard in the World API that allows restricting results to before or after a timestamp?

This would be similar to the "sinceid" and "beforeid" optional parameters, but instead of specifying event IDs we would specify a timestamp.

Currently, if I want to fetch happenings of some sort that happened during, say, the last 6 hours, I need to make multiple API calls using the sinceid option, decrementing the event ID until I encounter an event with a timestamp more than 6 hours old. With my suggested addition, I would be able to do the same with one API call.

Thanks in advance.

Bumping this to make sure it is not forgotten. It'd be great if the Happenings option I describe could be added. Thanks again.

User avatar
Zemnaya Svoboda
Diplomat
 
Posts: 867
Founded: Jan 06, 2004
Civil Rights Lovefest

Postby Zemnaya Svoboda » Fri Oct 09, 2015 4:59 pm

The United Island Tribes wrote:
Frisbeeteria wrote:Easy enough. File a GHR from the nation holding an API recruitment key and we can lock you out. If you don't have one, go found a region with a puppet and request one, then explain about the lock testing.


Are you saying my telegram api client_key needs to be locked out? I rather keep one key operation. Am I allowed to have two api keys? (two separate regions of course)

Use mock-nationstates. It's quite happy to ban you from your mock NS API server for spamming, and you don't harm anyone while doing so

User avatar
Zemnaya Svoboda
Diplomat
 
Posts: 867
Founded: Jan 06, 2004
Civil Rights Lovefest

Postby Zemnaya Svoboda » Sat Oct 10, 2015 12:10 pm

Is there any chance of a region zombie shard being added? (The total dead, survivors, and zombies, like for the nation zombie shard, is what I'd have in mind)

Could I also suggest adding a national happening for adopting a zombie policy? (Whether export, exterminate, research, or none at all).

User avatar
[violet]
Executive Director
 
Posts: 16207
Founded: Antiquity

Postby [violet] » Sun Oct 11, 2015 7:00 pm

The United Island Tribes wrote:I need a way to ban myself from the api to test and fix how my python module handles api temp bans.

It's no problem to spam it now and again. It will just auto-ban you for 15 minutes; it won't mark it down on your permanent record.

Just FYI, the best deliberately bad API request you can do is probably this:

http://www.nationstates.net/cgi-bin/api.cgi?a=sendtg

... since it will immediately error out as malformed on our side without attempting any more expensive checks.

User avatar
Eluvatar
Director of Technology
 
Posts: 3086
Founded: Mar 31, 2006
New York Times Democracy

Postby Eluvatar » Sun Oct 18, 2015 2:00 am

A few things.




In desperate hope of inducing admin to look kindly on my earlier request, I present yet another run of wa_members_validator output:

The following nations listed in http://www.nationstates.net/cgi-bin/api ... /q=members are not WA nations:

Worse, the following WA nations are not listed in http://www.nationstates.net/cgi-bin/api.cgi/wa=1/q=members:





I'd like to put forward my Trawler modules which I have now made a topic for in Technical. It may be appropriate to link to that topic from the API help page, if you find the topic usable.
Last edited by Eluvatar on Sun Oct 18, 2015 2:00 am, edited 1 time in total.
To Serve and Protect: UDL

Eluvatar - Taijitu member

User avatar
[violet]
Executive Director
 
Posts: 16207
Founded: Antiquity

Postby [violet] » Tue Oct 20, 2015 3:41 pm

Zemnaya Svoboda wrote:Is there any chance of a region zombie shard being added? (The total dead, survivors, and zombies, like for the nation zombie shard, is what I'd have in mind)

Added, and updated API doc.

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

Postby Trotterdam » Wed Oct 21, 2015 5:36 pm

[violet] wrote:Added, and updated API doc.
Thanks, this will be a great help!

But one thing: the API currently returns nothing unless the zombie event is active. Could you make it so that, outside of a zombie event, it returns that data as of the end of the last zombie event? Not so much because I still care about that data eleven months later (though a debriefing immediately after could be nice), but so that I have sample data I can test my program with before the event starts :)

User avatar
[violet]
Executive Director
 
Posts: 16207
Founded: Antiquity

Postby [violet] » Wed Oct 21, 2015 9:54 pm

Trotterdam wrote:Could you make it so that, outside of a zombie event, it returns that data as of the end of the last zombie event?

Done, but be aware it may be unreliable outside of Z-Day, beforehand because we sometimes run tests, and afterward because it won't continue to track populations accurately (so # of survivors will grow but not dead or zombies).

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

Postby Trotterdam » Thu Oct 22, 2015 12:36 pm

[violet] wrote:because it won't continue to track populations accurately (so # of survivors will grow but not dead or zombies).
I am aware of this.

It happens even during the apocalypse, since it lasts longer than 24 hours, so there's a population-increasing tick in the middle. It can cause survivors to suddenly appear in a previously-dead nation.

It's not a problem for me though, I just need numbers, they don't need to be correct numbers.

Thanks.

User avatar
Frisbeeteria
Senior Game Moderator
 
Posts: 27796
Founded: Dec 16, 2003
Capitalizt

Postby Frisbeeteria » Thu Oct 22, 2015 2:34 pm

Trotterdam wrote: I just need numbers, they don't need to be correct numbers.

1
2001
3.14159
149,597,870,700
1.414213562373095
-1
2.6854520010
−1.1×10−12

There ya go.

User avatar
HMS Unicorn
Spokesperson
 
Posts: 199
Founded: Jun 29, 2005
Ex-Nation

Postby HMS Unicorn » Wed Oct 28, 2015 4:11 pm

Would it be possible to add shards to the Region API for:

1) Regional Officers. Ideally, this would return both which nations are ROs and what powers each RO has. However, even just listing the ROs without specifying their powers would be very helpful.

2) Recruitment Settings. Ideally, this would return whether the region has activated one of the standard options (API only, officers only, etc.), or the list of authorized nations.

For (1), I'm primarily interested in gathering some statistics for large regions. Though more generally, given that the founder and delegate information are available through the API, I believe it'd make sense to also make available regional officers.

For (2), I frequently need to authenticate whether a nation has recruitment permissions for a given region.

In both cases, this information can be grabbed from the regional administration page, but it'd be a lot more efficient if the API could be used instead. I expect both of these shards will be useful to other players for similar reasons.

Thanks in advance!

User avatar
The Blaatschapen
Technical Moderator
 
Posts: 63227
Founded: Antiquity
Anarchy

Postby The Blaatschapen » Wed Oct 28, 2015 4:15 pm

HMS Unicorn wrote:Would it be possible to add shards to the Region API for:

1) Regional Officers. Ideally, this would return both which nations are ROs and what powers each RO has. However, even just listing the ROs without specifying their powers would be very helpful.

2) Recruitment Settings. Ideally, this would return whether the region has activated one of the standard options (API only, officers only, etc.), or the list of authorized nations.

For (1), I'm primarily interested in gathering some statistics for large regions. Though more generally, given that the founder and delegate information are available through the API, I believe it'd make sense to also make available regional officers.

For (2), I frequently need to authenticate whether a nation has recruitment permissions for a given region.

In both cases, this information can be grabbed from the regional administration page, but it'd be a lot more efficient if the API could be used instead. I expect both of these shards will be useful to other players for similar reasons.

Thanks in advance!


On number 1: Ideally, I would also like to see the names of the offices being returned; also in the daily dumpfile, so I can run naughty word filters on it (I should run one again soon) :)
The Blaatschapen should resign

User avatar
Misley
Diplomat
 
Posts: 609
Founded: Jan 05, 2009
Ex-Nation

Postby Misley » Wed Oct 28, 2015 4:16 pm

HMS Unicorn wrote:Would it be possible to add shards to the Region API for:

1) Regional Officers. Ideally, this would return both which nations are ROs and what powers each RO has. However, even just listing the ROs without specifying their powers would be very helpful.

2) Recruitment Settings. Ideally, this would return whether the region has activated one of the standard options (API only, officers only, etc.), or the list of authorized nations.

For (1), I'm primarily interested in gathering some statistics for large regions. Though more generally, given that the founder and delegate information are available through the API, I believe it'd make sense to also make available regional officers.

For (2), I frequently need to authenticate whether a nation has recruitment permissions for a given region.

In both cases, this information can be grabbed from the regional administration page, but it'd be a lot more efficient if the API could be used instead. I expect both of these shards will be useful to other players for similar reasons.

Thanks in advance!

#1 would be very useful, particularly if it included powers granted to the Founders (regions with non-executive founders, for example) and WA Delegate now that it's not a binary "executive"/"non-executive".
EGO·VERO·CUSTOSFRATRIS·MEI·SUM
Socialist People's Provinces of Misley

   
Editor of the Red & Black
Fleet Admiral of The Red Fleet
Custodian of The Internationale

User avatar
HMS Unicorn
Spokesperson
 
Posts: 199
Founded: Jun 29, 2005
Ex-Nation

Postby HMS Unicorn » Wed Oct 28, 2015 4:27 pm

Misley's post reminded me that I also wanted to ask for an API-based way to tell whether a Founder or Delegate is executive or non-executive. As far as I can tell from an (admittedly not thorough) search, there's currently no such information available through the API.

Providing this information in the way Misley suggests is perfectly fine as far as I am concerned.

User avatar
Zemnaya Svoboda
Diplomat
 
Posts: 867
Founded: Jan 06, 2004
Civil Rights Lovefest

Postby Zemnaya Svoboda » Wed Oct 28, 2015 6:19 pm

Seeking to be grateful for the new Influence Ranks, another run of the WA membership validator:
The following nations listed in http://www.nationstates.net/cgi-bin/api ... /q=members are not WA nations:

Worse, the following WA nations are not listed in http://www.nationstates.net/cgi-bin/api.cgi/wa=1/q=members:


(Edit: reminder: the pages tend to shift, sometimes quite quickly).
Last edited by Zemnaya Svoboda on Wed Oct 28, 2015 6:20 pm, edited 1 time in total.

User avatar
Athretvari
Diplomat
 
Posts: 574
Founded: Apr 29, 2012
Liberal Democratic Socialists

Pretty pretty please, Dear [Violet]. :)

Postby Athretvari » Tue Nov 03, 2015 10:29 am

Can GDP or (better yet) GDP per Capita be added to the API? Also, black market and state-owned industries percents?

It would really open it up for economic calcs.

AiDataOne | Athretvari

Right now I can pull nearly everything I need via the API except GDPPC, black market, and state owned percents, which I'm inputting manually via a factbook page that is read by my spreadsheet.
Athretvari
The Realms Banner (flag)
Yeah… I know. It’s a tough one. You can skip

User avatar
Laevendell
Envoy
 
Posts: 220
Founded: Jan 29, 2011
Left-wing Utopia

Postby Laevendell » Wed Nov 04, 2015 4:20 am

Athretvari wrote:Can GDP or (better yet) GDP per Capita be added to the API? Also, black market and state-owned industries percents?

It would really open it up for economic calcs.

It would also be very nice for NSDroid!

Also, for the zombie data, I was thinking of making a special zombie-part in the app for next year and was hoping we could get the infection rate, research status etc. for the region in the API before then? If anyone has any suggestions about this part in the app, please let me know in the NSDroid thread.

Finally, it's time for the semi-regular question about a logged-in API. Perhaps someone has had time to take a look at it by now and has some input?
Refer to: viewtopic.php?p=23479734#p23479734
Last edited by Laevendell on Wed Nov 04, 2015 4:28 am, edited 1 time in total.

User avatar
ValosaCAtX
Political Columnist
 
Posts: 3
Founded: May 07, 2015
Ex-Nation

Postby ValosaCAtX » Fri Nov 20, 2015 7:02 am

Cards against nations states isn't working.

User avatar
The Blaatschapen
Technical Moderator
 
Posts: 63227
Founded: Antiquity
Anarchy

Postby The Blaatschapen » Fri Nov 20, 2015 7:06 am

ValosaCAtX wrote:Cards against nations states isn't working.


There's no API for Cards against NS. So that makes sense.
The Blaatschapen should resign

User avatar
Zemnaya Svoboda
Diplomat
 
Posts: 867
Founded: Jan 06, 2004
Civil Rights Lovefest

Postby Zemnaya Svoboda » Mon Nov 23, 2015 2:09 am

I hate to sound like a broken record, but there are those who rely on the WA members list.

The following nations listed in http://www.nationstates.net/cgi-bin/api ... /q=members are not WA nations:

Worse, the following WA nations are not listed in http://www.nationstates.net/cgi-bin/api.cgi/wa=1/q=members:

User avatar
[violet]
Executive Director
 
Posts: 16207
Founded: Antiquity

Postby [violet] » Mon Nov 23, 2015 5:52 pm

Per requests above, added more shards.

To Nation shards:
  • gdp
  • sectors
  • income
  • poorest
  • richest

To Region shards:
  • officers
  • delegateauth
  • founderauth

User avatar
Misley
Diplomat
 
Posts: 609
Founded: Jan 05, 2009
Ex-Nation

Postby Misley » Mon Nov 23, 2015 5:56 pm

[violet] wrote:To Region shards:
  • officers
  • delegateauth
  • founderauth

Any chance these could be added to the daily dumps?

edit: Also, any chance "delegateauth" could still report the authorities granted to an unfilled Delegate seat?
Last edited by Misley on Mon Nov 23, 2015 6:00 pm, edited 1 time in total.
EGO·VERO·CUSTOSFRATRIS·MEI·SUM
Socialist People's Provinces of Misley

   
Editor of the Red & Black
Fleet Admiral of The Red Fleet
Custodian of The Internationale

PreviousNext

Advertisement

Remove ads

Return to Technical

Who is online

Users browsing this forum: Bisofeyr, Jacobopolus

Advertisement

Remove ads