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
New Rogernomics
Powerbroker
 
Posts: 9144
Founded: Aug 22, 2006
Left-wing Utopia

Postby New Rogernomics » Mon Sep 02, 2019 9:31 am

Hey there, I have a two part question, if this is the right place to ask this.

I have been learning more about how the Nationstates Telegram API is implemented, and I have a question concerning this.

If a nation is a founder in a UCR, or the delegate of a GCR, and they allow nation X to get the API key for recruiting, and nation X CTEs, does that only API key become open to nation Y to acquire the key?

Join the Lazarus Reform Club for healthy discussion on Lazarus.

Holds silly opinions on some things, and likes animals of all kinds, including the scary ones.
Pro: Individualism, Humanism, Human Rights, Internationalism & Free Markets, Democracy, Decentralization, Treaty of Sèvres, Free Hong Kong.
Against: Social Conservatism, Religious Extremism, Extreme Nationalism, Racism, Homo/Trans phobia, Authoritarianism.

User avatar
Phydios
Minister
 
Posts: 2302
Founded: Dec 06, 2014
New York Times Democracy

Postby Phydios » Mon Sep 02, 2019 10:06 am

New Rogernomics wrote:Hey there, I have a two part question, if this is the right place to ask this.

I have been learning more about how the Nationstates Telegram API is implemented, and I have a question concerning this.

If a nation is a founder in a UCR, or the delegate of a GCR, and they allow nation X to get the API key for recruiting, and nation X CTEs, does that only API key become open to nation Y to acquire the key?

API keys are issued per region, so they aren't locked to a specific nation. Nation Y can use the key any time that no one else is using it.
Romans 1:18-2:29, Ephesians 2:1-10
But God’s angry displeasure erupts as acts of human mistrust and wrongdoing and lying accumulate, as people try to put a shroud over truth. But the basic reality of God is plain enough. Open your eyes and there it is! | Those people are on a dark spiral downward. But if you think that leaves you on the high ground where you can point your finger at others, think again. Every time you criticize someone, you condemn yourself. | It’s a wonder God didn’t lose His temper and do away with the whole lot of us. Instead, immense in mercy and with an incredible love, He embraced us. He took our sin-dead lives and made us alive in Christ. He did all this on His own, with no help from us!

User avatar
New Rogernomics
Powerbroker
 
Posts: 9144
Founded: Aug 22, 2006
Left-wing Utopia

Postby New Rogernomics » Mon Sep 02, 2019 4:40 pm

Phydios wrote:
New Rogernomics wrote:Hey there, I have a two part question, if this is the right place to ask this.

I have been learning more about how the Nationstates Telegram API is implemented, and I have a question concerning this.

If a nation is a founder in a UCR, or the delegate of a GCR, and they allow nation X to get the API key for recruiting, and nation X CTEs, does that only API key become open to nation Y to acquire the key?

API keys are issued per region, so they aren't locked to a specific nation. Nation Y can use the key any time that no one else is using it.
That is not correct apparently. There is only one key per region. If you don't know the key or have access to it, then no other nation can use it. A good example would be where a regional officer nation or a founder acquires the key, and then CTEs.
Last edited by New Rogernomics on Mon Sep 02, 2019 4:42 pm, edited 1 time in total.

Join the Lazarus Reform Club for healthy discussion on Lazarus.

Holds silly opinions on some things, and likes animals of all kinds, including the scary ones.
Pro: Individualism, Humanism, Human Rights, Internationalism & Free Markets, Democracy, Decentralization, Treaty of Sèvres, Free Hong Kong.
Against: Social Conservatism, Religious Extremism, Extreme Nationalism, Racism, Homo/Trans phobia, Authoritarianism.

User avatar
Frisbeeteria
Senior Game Moderator
 
Posts: 24637
Founded: Dec 16, 2003
Anarchy

Postby Frisbeeteria » Mon Sep 02, 2019 5:18 pm

Phydios wrote:API keys are issued per region, so they aren't locked to a specific nation. Nation Y can use the key any time that no one else is using it.

There's a lot wrong with this statement. Keys are tied to a region, but a single nation is considered 'responsible' for it. If another nation misuses the key, the responsible nation could get a warning. Sharing a key requires a fair bit of trust.

Also, "any time that no one else is using it" is misleading. Multiple nations can use the same key simultaneously - it's just pointless. The rate limit applies to the key rather than the nation, so every recruiter after the first will probably bounce 100% of their attempts.

New Rogernomics wrote:A good example would be where a regional officer nation or a founder acquires the key, and then CTEs.

In such cases, a Getting Help Request can get the old key deactivated and a new key issued. Same if the old recruiter nation moved to a new region. Unfortunately, it's not the same for living-but-inactive recruiter nations. We won't reissue the key if the nation is alive and still in the region.

New Rogernomics wrote: does that only API key become open to nation Y to acquire the key?

We'd issue a different key, cancelling the old one.

User avatar
New Rogernomics
Powerbroker
 
Posts: 9144
Founded: Aug 22, 2006
Left-wing Utopia

Postby New Rogernomics » Mon Sep 02, 2019 7:09 pm

Okay I get how it works now.

I had thought it would be a bit odd if a key could get lost forever.

Thanks for explaining it.

Join the Lazarus Reform Club for healthy discussion on Lazarus.

Holds silly opinions on some things, and likes animals of all kinds, including the scary ones.
Pro: Individualism, Humanism, Human Rights, Internationalism & Free Markets, Democracy, Decentralization, Treaty of Sèvres, Free Hong Kong.
Against: Social Conservatism, Religious Extremism, Extreme Nationalism, Racism, Homo/Trans phobia, Authoritarianism.

User avatar
Phydios
Minister
 
Posts: 2302
Founded: Dec 06, 2014
New York Times Democracy

Postby Phydios » Mon Sep 02, 2019 8:43 pm

Frisbeeteria wrote:
Phydios wrote:API keys are issued per region, so they aren't locked to a specific nation. Nation Y can use the key any time that no one else is using it.

There's a lot wrong with this statement. Keys are tied to a region, but a single nation is considered 'responsible' for it. If another nation misuses the key, the responsible nation could get a warning. Sharing a key requires a fair bit of trust.

Also, "any time that no one else is using it" is misleading. Multiple nations can use the same key simultaneously - it's just pointless. The rate limit applies to the key rather than the nation, so every recruiter after the first will probably bounce 100% of their attempts.

New Rogernomics wrote:A good example would be where a regional officer nation or a founder acquires the key, and then CTEs.

In such cases, a Getting Help Request can get the old key deactivated and a new key issued. Same if the old recruiter nation moved to a new region. Unfortunately, it's not the same for living-but-inactive recruiter nations. We won't reissue the key if the nation is alive and still in the region.

New Rogernomics wrote: does that only API key become open to nation Y to acquire the key?

We'd issue a different key, cancelling the old one.

Got it. Thanks for the clarification. I was going off my own experience with the Telegram API.
Romans 1:18-2:29, Ephesians 2:1-10
But God’s angry displeasure erupts as acts of human mistrust and wrongdoing and lying accumulate, as people try to put a shroud over truth. But the basic reality of God is plain enough. Open your eyes and there it is! | Those people are on a dark spiral downward. But if you think that leaves you on the high ground where you can point your finger at others, think again. Every time you criticize someone, you condemn yourself. | It’s a wonder God didn’t lose His temper and do away with the whole lot of us. Instead, immense in mercy and with an incredible love, He embraced us. He took our sin-dead lives and made us alive in Christ. He did all this on His own, with no help from us!

User avatar
Minoa
Senator
 
Posts: 4645
Founded: Oct 05, 2011
Civil Rights Lovefest

Postby Minoa » Thu Sep 26, 2019 6:59 am

Regarding: https://www.nationstates.net/cgi-bin/ap ... ction;id=1

Hello, I wish to ask if there is a way to combine queries for N-Day faction data… strikes, stockpiled nukes and all that? For example, https://www.nationstates.net/cgi-bin/ap ... ;id=1;id=2 doesn't work.

Best,

-- Minoa
Last edited by Minoa on Thu Sep 26, 2019 7:00 am, edited 2 times in total.
Mme A. d'Oiseau, B.A. (State of Minoa)

User avatar
RantSpot
Secretary
 
Posts: 36
Founded: Feb 15, 2010
Civil Rights Lovefest

Postby RantSpot » Thu Sep 26, 2019 12:15 pm

I saw requests by The Northern Light for some card API shards back in January and March. Was there ever any decision on that? It makes sense for cards to only be generated by manual website issue answers and not API, but all the other card game features e.g. buying, auctioning, valuing could be handled by API, and other rich applications could be built for the marketplace.

User avatar
Minoa
Senator
 
Posts: 4645
Founded: Oct 05, 2011
Civil Rights Lovefest

Postby Minoa » Fri Sep 27, 2019 4:53 am

Source: https://www.nationstates.net/cgi-bin/ap ... ion;id=246

I have observed that the API is not recording the names of the regions which a faction belongs to, if region in question ceased to exist. I believe that the name of the region should stay as a matter of historical record.

-- Minoa
Mme A. d'Oiseau, B.A. (State of Minoa)

User avatar
Darcania
Spokesperson
 
Posts: 150
Founded: Dec 29, 2014
Ex-Nation

Postby Darcania » Sat Nov 02, 2019 2:33 pm

Could it be made possible to have a private nation API shard to apply to (not join, just apply to) the World Assembly?

User avatar
Flanderlion
Ambassador
 
Posts: 1583
Founded: Nov 25, 2013
Iron Fist Consumerists

Postby Flanderlion » Sun Nov 03, 2019 3:58 am

Darcania wrote:Could it be made possible to have a private nation API shard to apply to (not join, just apply to) the World Assembly?

I would assume that it would still be illegal to use a script to apply to join the WA. Admins replied multiple times re that until finally it was settled my script for it was illegal as it was generating a happening other that my nation page. Wasn't 100% on the logic from it, but they've got the GHR history to go through to see what they said in the past.

If it is legal, yes please, is very helpful for prepping tagging puppets.

Edit: Added missing it.
Edit 2: Was 3, almost 4 years ago, script rules were edited following it. I've only got the replies, not what I sent.
Last edited by Flanderlion on Sun Nov 03, 2019 4:10 am, edited 2 times in total.
As always, I'm representing myself.

User avatar
Valentine Z
Powerbroker
 
Posts: 7811
Founded: Nov 08, 2015
Scandinavian Liberal Paradise

Postby Valentine Z » Fri Nov 22, 2019 4:56 am

viewtopic.php?p=36459354#p36459354

Cross-posting from my own thread, I recently noticed and realised that there are undocumented (at least on the API Doc itself) ways of getting more precise data for some NS Stats.

For instance, http://www.nationstates.net/cgi-bin/api.cgi?nation=valentine_z&q=census&scale=68&mode=score is a well-known and what I have been using to get the stats as they appear on the census. However... https://www.nationstates.net/cgi-bin/api.cgi?nation=valentine_z&q=hdi, whereby q=hdi is not mentioned in the public shard section, gives precise HDI values, to several decimal places.

This would explain why as the bigger nations continue to answer issues, their HDI increments at 0.01 on the gameside, but in reality... there are minute changes that are still happening, and eventually, they will round up and give that 0.01.

I wonder if there are precise values for Integrity, Civil Rights, Economy, etc... basically a way to get all these stats' precise results instead of the rounded http://www.nationstates.net/cgi-bin/api.cgi?nation=valentine_z&q=census&scale=all&mode=score.
Last edited by Valentine Z on Fri Nov 22, 2019 4:59 am, edited 3 times in total.



Valentine Z GIF Flag (Improved!)
The Valentine Z CV.
NationStates 1st Flag Bracket - 1st place!
Issues Thread 4th in Gen Sec

The Sixty! Opinions Deposit! Valentian Stories! Gwen's Adventures! Cat Anthem! Valentian News.
If you are reading my sig, I want you to have the best day ever ! You are worth it, do not let anyone get you down !
Glory to De Geweldige Sierlijke Katachtige Utopia en Zijne Autonome Machten ov Valentine Z !
Q & A Here! | Heights of NS! | F7 Etiquette

Clarissa mistaken for Smurf/Avatar: 10
Valentijn called She: 38
Disappointing F7 Responses: 225

• Eat my freaking tranquility. - Zenyatta
• Never trouble trouble until trouble troubles you.
• World Map is a cat playing with Australia.

• Am I a pretty girl?

User avatar
Trotterdam
Powerbroker
 
Posts: 8572
Founded: Jan 12, 2012
Left-Leaning College State

Postby Trotterdam » Fri Nov 22, 2019 9:40 am

Valentine Z wrote:However... https://www.nationstates.net/cgi-bin/api.cgi?nation=valentine_z&q=hdi, whereby q=hdi is not mentioned in the public shard section, gives precise HDI values, to several decimal places.
Wow, it's possible to track people's lifespans to an accuracy of three microseconds?

User avatar
Valentine Z
Powerbroker
 
Posts: 7811
Founded: Nov 08, 2015
Scandinavian Liberal Paradise

Postby Valentine Z » Fri Nov 22, 2019 11:43 am

Trotterdam wrote:
Valentine Z wrote:However... https://www.nationstates.net/cgi-bin/api.cgi?nation=valentine_z&q=hdi, whereby q=hdi is not mentioned in the public shard section, gives precise HDI values, to several decimal places.
Wow, it's possible to track people's lifespans to an accuracy of three microseconds?

Happy 14th and 1 microsecond birthday, to you. :P
Last edited by Valentine Z on Fri Nov 22, 2019 11:43 am, edited 1 time in total.



Valentine Z GIF Flag (Improved!)
The Valentine Z CV.
NationStates 1st Flag Bracket - 1st place!
Issues Thread 4th in Gen Sec

The Sixty! Opinions Deposit! Valentian Stories! Gwen's Adventures! Cat Anthem! Valentian News.
If you are reading my sig, I want you to have the best day ever ! You are worth it, do not let anyone get you down !
Glory to De Geweldige Sierlijke Katachtige Utopia en Zijne Autonome Machten ov Valentine Z !
Q & A Here! | Heights of NS! | F7 Etiquette

Clarissa mistaken for Smurf/Avatar: 10
Valentijn called She: 38
Disappointing F7 Responses: 225

• Eat my freaking tranquility. - Zenyatta
• Never trouble trouble until trouble troubles you.
• World Map is a cat playing with Australia.

• Am I a pretty girl?

User avatar
The Order of the Holy Inquisitors
Secretary
 
Posts: 34
Founded: Jan 31, 2018
Iron Fist Consumerists

Postby The Order of the Holy Inquisitors » Fri Nov 22, 2019 4:57 pm

Hi there! I'm currently trying my hand at some basic data retrieval stuff using a wrapper for the API (was bored and thus looking for a challenge), and I noticed that on the Wrapper documentation page (here), it states I must "set a user agent." If I'm using a wrapper, is this step still mandatory, and if so, could you please direct me as to how exactly I should go about doing that?
Last edited by The Order of the Holy Inquisitors on Fri Nov 22, 2019 4:57 pm, edited 1 time in total.

User avatar
Trotterdam
Powerbroker
 
Posts: 8572
Founded: Jan 12, 2012
Left-Leaning College State

Postby Trotterdam » Fri Nov 22, 2019 7:36 pm

The Order of the Holy Inquisitors wrote:Hi there! I'm currently trying my hand at some basic data retrieval stuff using a wrapper for the API (was bored and thus looking for a challenge), and I noticed that on the Wrapper documentation page (here), it states I must "set a user agent." If I'm using a wrapper, is this step still mandatory, and if so, could you please direct me as to how exactly I should go about doing that?
Yes, setting a user agent is still mandatory.

The way to do this should be specified in the documentation for whichever wrapper you're using. If you can't find it, it's probably best to contact the wrapper's author for help.

User avatar
The Order of the Holy Inquisitors
Secretary
 
Posts: 34
Founded: Jan 31, 2018
Iron Fist Consumerists

Postby The Order of the Holy Inquisitors » Fri Nov 22, 2019 10:37 pm

Trotterdam wrote:
The Order of the Holy Inquisitors wrote:Hi there! I'm currently trying my hand at some basic data retrieval stuff using a wrapper for the API (was bored and thus looking for a challenge), and I noticed that on the Wrapper documentation page (here), it states I must "set a user agent." If I'm using a wrapper, is this step still mandatory, and if so, could you please direct me as to how exactly I should go about doing that?
Yes, setting a user agent is still mandatory.

The way to do this should be specified in the documentation for whichever wrapper you're using. If you can't find it, it's probably best to contact the wrapper's author for help.

Thank you so much! I'll get on that ASAP

Edit: I think I got it set properly (registers my nation site link as the value of the userAgent variable and logs to the console the name of the wrapper creator and me as a "user" of it. I think this is enough, but if I want to double check, would I just go to the author of the wrapper again?
Last edited by The Order of the Holy Inquisitors on Fri Nov 22, 2019 11:10 pm, edited 3 times in total.

User avatar
Trotterdam
Powerbroker
 
Posts: 8572
Founded: Jan 12, 2012
Left-Leaning College State

Postby Trotterdam » Sat Nov 23, 2019 12:17 am

The Order of the Holy Inquisitors wrote:Edit: I think I got it set properly (registers my nation site link as the value of the userAgent variable and logs to the console the name of the wrapper creator and me as a "user" of it. I think this is enough, but if I want to double check, would I just go to the author of the wrapper again?
For clarification on what constitutes a sufficiently-informative user agent you'll need to contact the actual game staff (for which this is the right thread, so just wait and hope for a response), since they're the only ones with the authority to make a ruling on that. The wrapper just determines how you set your user agent, not what you should set it to.

I don't understand what you mean by "logs to the console", though. Unless I'm misunderstanding, what your program logs to your console shouldn't be relevant to anyone except yourself.

User avatar
Frisbeeteria
Senior Game Moderator
 
Posts: 24637
Founded: Dec 16, 2003
Anarchy

Postby Frisbeeteria » Sat Nov 23, 2019 9:59 am

Trotterdam wrote:For clarification on what constitutes a sufficiently-informative user agent you'll need to contact the actual game staff

We want something that will let us get back to you if something goes wrong. Your main nation or email address are both acceptable. I'd personally go for 'blatantly obvious' and call mine "Frisbeeteria Recruitment Script".

User avatar
The Order of the Holy Inquisitors
Secretary
 
Posts: 34
Founded: Jan 31, 2018
Iron Fist Consumerists

Postby The Order of the Holy Inquisitors » Sat Nov 23, 2019 4:48 pm

Trotterdam wrote:For clarification on what constitutes a sufficiently-informative user agent you'll need to contact the actual game staff (for which this is the right thread, so just wait and hope for a response), since they're the only ones with the authority to make a ruling on that. The wrapper just determines how you set your user agent, not what you should set it to.

I don't understand what you mean by "logs to the console", though. Unless I'm misunderstanding, what your program logs to your console shouldn't be relevant to anyone except yourself.

Okay. I was just logging the value that I set it to to my own console to make sure it worked. Thank you for your help!

Frisbeeteria wrote:We want something that will let us get back to you if something goes wrong. Your main nation or email address are both acceptable. I'd personally go for 'blatantly obvious' and call mine "Frisbeeteria Recruitment Script".

I put the link to my nation.

User avatar
SherpDaWerp
Diplomat
 
Posts: 627
Founded: Mar 02, 2016
Civil Rights Lovefest

Postby SherpDaWerp » Tue Dec 03, 2019 4:44 pm

Is there a more efficient way for me to query the political freedoms/civil rights/economic freedoms for every nation than just slowly going through every nation individually? I'm looking to build up an idea of the thresholds for each WA classification, so a large sample size (every nation) is best IMO.

Economic Freedom is not listed in the daily dump, although civil rights, political freedoms and WA classification are. At the moment, it looks like my best option is to use the daily dump, but then I'd still have to manually query the economic freedom of every nation. (Despite the fact that there is ECONOMY under FREEDOM and FREEDOMSCORES, these values represent the economic strength census rather than the economic freedom one...)
IRL: High school student who actually doesn't have any assignments left to do...
NS: Owner of Imperial Stronghold | Citizen of The North Pacific | Writer of Issues | One-time Delegate of Glass Gallows | My color is epic

User avatar
[violet]
Site Admin
 
Posts: 14540
Founded: Antiquity

Postby [violet] » Wed Dec 11, 2019 4:58 pm

There is now a Cards API in development. It's subject to change without warning, but is pretty functional already.

Documentation here:

https://www.nationstates.net/pages/api.html#cards

User avatar
Flanderlion
Ambassador
 
Posts: 1583
Founded: Nov 25, 2013
Iron Fist Consumerists

Postby Flanderlion » Wed Dec 11, 2019 5:47 pm

[violet] wrote:There is now a Cards API in development. It's subject to change without warning, but is pretty functional already.

Documentation here:

https://www.nationstates.net/pages/api.html#cards

Thanks for writing this up, was trying to keep track through a myriad of bookmarks. Can you add the two card files to the doc as well? Probably under the Daily Dump section.
As always, I'm representing myself.

User avatar
[violet]
Site Admin
 
Posts: 14540
Founded: Antiquity

Postby [violet] » Wed Dec 11, 2019 8:59 pm

Flanderlion wrote:Can you add the two card files to the doc as well? Probably under the Daily Dump section.

What do you mean?

User avatar
Flanderlion
Ambassador
 
Posts: 1583
Founded: Nov 25, 2013
Iron Fist Consumerists

Postby Flanderlion » Thu Dec 12, 2019 3:49 am

[violet] wrote:
Flanderlion wrote:Can you add the two card files to the doc as well? Probably under the Daily Dump section.

What do you mean?

viewtopic.php?f=42&t=468779

These two files, just so everything that would help tool related wise is in the same place.
As always, I'm representing myself.

PreviousNext

Advertisement

Remove ads

Return to Technical

Who is online

Users browsing this forum: 20XX, Google Adsense [Bot], Kirieland

Advertisement

Remove ads