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
Not a pipe
Diplomat
 
Posts: 748
Founded: Apr 18, 2012
Ex-Nation

Postby Not a pipe » Tue May 15, 2012 1:12 am

One thing I want to do is to backup the public data of a nation (including factbooks, and history of changes), I can write a program to do so locally. It will run when the user runs it. I will not put it on a webpage but I will post the codes if you want it. Please tell me if there are things missing from API, or anything else of importance to do such things, or if such a program already exists (command-line is prefered).
View signature:
Viva la rivoluzione contro I moderatori fascisti!

I agree to put all of my messages here public domain please use them as public domain no copyright.

Patents should be abolished. Copyrights should be reduced.

The human population is already being too much! Let's make them get reduced over time instead.
D&D:
Name: Iuckqlwviv Kjugobe
Race: Illithid
Class: Wizard/Cerebremancer/Illithid Savant
Align: NG
Skills: scribe, sailor, search, languages, spot, listen, concentration, disable device, forgery, hide, healing, spellcraft, decipher script, ...
Spells: amanuensis, time hop, grease, force screen, modify memory, trace teleport, major creation, true seeing, extend tentacles, locate object, dimension door, object mirroring, prestidigitation, touch of health, ...

User avatar
Scoochi2
Envoy
 
Posts: 207
Founded: Antiquity
Ex-Nation

Postby Scoochi2 » Sat May 19, 2012 5:25 pm

Unibot II wrote:
Scoochi2 wrote:Would it be possible to add in an extra shard to indicate whether a region has a password or not?
Could this be included in the daily dump?

Possible examples:
Code: Select all
<PASSWORDED>None</PASSWORDED>

<PASSWORDED>Displayed</PASSWORDED>

<PASSWORDED>Hidden</PASSWORDED>


This would be very helpful.

ummm... please? :)
The problem with a UDP joke is that you have no idea if people got it.

User avatar
Ballotonia
Senior Admin
 
Posts: 5494
Founded: Antiquity
Inoffensive Centrist Democracy

Postby Ballotonia » Mon May 21, 2012 12:11 am

"Een volk dat voor tirannen zwicht zal meer dan lijf en goed verliezen, dan dooft het licht…" -- H.M. van Randwijk

User avatar
SunRawr
Ambassador
 
Posts: 1209
Founded: May 30, 2011
Ex-Nation

Postby SunRawr » Mon May 21, 2012 8:07 am

Fantastic. Thank you!

User avatar
Fischistan
Ambassador
 
Posts: 1384
Founded: Oct 16, 2011
Ex-Nation

Postby Fischistan » Mon May 21, 2012 11:55 am


Is this a multi tag search?

I love you Ballo! :hug:
Xavier D'Montagne
Fischistani Ambassador to the WA
Unibot II wrote:It's Carta. He CANNOT Fail. Only successes in reverse.
The Matthew Islands wrote:Knowledge is knowing the Tomato is a fruit. Wisdom is knowing not to put it in a fruit salad.
Anthony Delasanta wrote:its was not genocide it was ethnic cleansing...
Socorra wrote:A religion-free abortion thread is like a meat-free hamburger.
Help is on its Way: UDL
Never forget 11 September.
Never look off the edge of cliff on a segway.

11 September 1973, of course.

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

Postby Zemnaya Svoboda » Mon May 21, 2012 6:38 pm


Very nice :)

User avatar
Fischistan
Ambassador
 
Posts: 1384
Founded: Oct 16, 2011
Ex-Nation

Postby Fischistan » Tue May 22, 2012 2:37 pm


Could you make this have a feature to search for regions without a tag? Like q=regionsbytags;tags=world_assembly,-no_sc_campaignign
Xavier D'Montagne
Fischistani Ambassador to the WA
Unibot II wrote:It's Carta. He CANNOT Fail. Only successes in reverse.
The Matthew Islands wrote:Knowledge is knowing the Tomato is a fruit. Wisdom is knowing not to put it in a fruit salad.
Anthony Delasanta wrote:its was not genocide it was ethnic cleansing...
Socorra wrote:A religion-free abortion thread is like a meat-free hamburger.
Help is on its Way: UDL
Never forget 11 September.
Never look off the edge of cliff on a segway.

11 September 1973, of course.

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

Postby [violet] » Tue May 22, 2012 5:58 pm

Fischistan wrote:Could you make this have a feature to search for regions without a tag? Like q=regionsbytags;tags=world_assembly,-no_sc_campaignign

You see, Ballo, you give them a feature and they want more... more... always more!

User avatar
Fischistan
Ambassador
 
Posts: 1384
Founded: Oct 16, 2011
Ex-Nation

Postby Fischistan » Tue May 22, 2012 6:05 pm

[violet] wrote:
Fischistan wrote:Could you make this have a feature to search for regions without a tag? Like q=regionsbytags;tags=world_assembly,-no_sc_campaignign

You see, Ballo, you give them a feature and they want more... more... always more!

Yep, that's how being a game-admin works! Get used to the extra work :p
Xavier D'Montagne
Fischistani Ambassador to the WA
Unibot II wrote:It's Carta. He CANNOT Fail. Only successes in reverse.
The Matthew Islands wrote:Knowledge is knowing the Tomato is a fruit. Wisdom is knowing not to put it in a fruit salad.
Anthony Delasanta wrote:its was not genocide it was ethnic cleansing...
Socorra wrote:A religion-free abortion thread is like a meat-free hamburger.
Help is on its Way: UDL
Never forget 11 September.
Never look off the edge of cliff on a segway.

11 September 1973, of course.

User avatar
Crushing Our Enemies
Ambassador
 
Posts: 1413
Founded: Nov 16, 2004
Corporate Police State

Postby Crushing Our Enemies » Tue May 22, 2012 6:10 pm

[violet] wrote:You are definitely not genial.
[violet] wrote:Congratulations to Crushing Our Enemies for making the first ever purchase. :)

User avatar
Fischistan
Ambassador
 
Posts: 1384
Founded: Oct 16, 2011
Ex-Nation

Postby Fischistan » Tue May 22, 2012 6:12 pm

Fischistan wrote:Do the national events RSS feeds count as the API? Because I would like to know if we could access those at a rate similar to the API rate.

I want to bring this up again while [v] is here.
Xavier D'Montagne
Fischistani Ambassador to the WA
Unibot II wrote:It's Carta. He CANNOT Fail. Only successes in reverse.
The Matthew Islands wrote:Knowledge is knowing the Tomato is a fruit. Wisdom is knowing not to put it in a fruit salad.
Anthony Delasanta wrote:its was not genocide it was ethnic cleansing...
Socorra wrote:A religion-free abortion thread is like a meat-free hamburger.
Help is on its Way: UDL
Never forget 11 September.
Never look off the edge of cliff on a segway.

11 September 1973, of course.

User avatar
Christian Democrats
Postmaster-General
 
Posts: 10093
Founded: Jul 29, 2009
New York Times Democracy

Postby Christian Democrats » Tue May 22, 2012 10:32 pm

I've enjoyed looking at the data on the votes of WA members in specific regions.

http://www.nationstates.net/cgi-bin/api.cgi?region=catholic&q=gavote
http://www.nationstates.net/cgi-bin/api.cgi?region=catholic&q=scvote

Could the information from these shards be added to the voting pages?

http://www.nationstates.net/page=ga
http://www.nationstates.net/page=sc

For example, on the General Assembly page, I currently see the following:

Votes For: 2,306

Votes Against: 6,529

[Delegate Votes]

Voting Ends: in 1 day 10 hours

Your Regional WA Delegate, Etnofaz, has voted FOR this resolution.

Image Christian Democrats: AGAINST

[Vote For][Withdraw Vote]


Maybe the General Assembly page (and the Security Council page) could look something like this:

Votes For: 2,306

Votes Against: 6,529

[Delegate Votes]

Voting Ends: in 1 day 10 hours

Your Regional WA Delegate, Etnofaz, has voted FOR this resolution.

In your region, the voting is currently 4 nation(s) for and 3 nation(s) against this resolution.

Image Christian Democrats: AGAINST

[Vote For][Withdraw Vote]


Possibly, information also could be added from this shard: http://www.nationstates.net/cgi-bin/api.cgi?region=catholic&q=delegatevotes

Votes For: 2,306

Votes Against: 6,529

[Delegate Votes]

Voting Ends: in 1 day 10 hours

Your Regional WA Delegate, Etnofaz (19 votes), has voted FOR this resolution.

In your region, the voting is currently 4 nation(s) for and 3 nation(s) against this resolution.

Image Christian Democrats: AGAINST

[Vote For][Withdraw Vote]


I believe that making this change would bring valuable information to a greater number of players (i.e., the players who do not use the API). Also, for all we know, some players (especially new players) might not even know that their WA delegates receive additional votes. If the second change were made, this would inform them.
Leo Tolstoy wrote:Wrong does not cease to be wrong because the majority share in it.
GA#160: Forced Marriages Ban Act (79%)
GA#175: Organ and Blood Donations Act (68%)^
SC#082: Repeal "Liberate Catholic" (80%)
GA#200: Foreign Marriage Recognition (54%)
GA#213: Privacy Protection Act (70%)
GA#231: Marital Rape Justice Act (81%)^
GA#233: Ban Profits on Workers' Deaths (80%)*
GA#249: Stopping Suicide Seeds (70%)^
GA#253: Repeal "Freedom in Medical Research" (76%)
GA#285: Assisted Suicide Act (70%)^
GA#310: Disabled Voters Act (81%)
GA#373: Repeal "Convention on Execution" (54%)
GA#468: Prohibit Private Prisons (57%)^

* denotes coauthorship
^ repealed resolution
#360: Electile Dysfunction
#452: Foetal Furore
#560: Bicameral Backlash
#570: Clerical Errors

User avatar
Ballotonia
Senior Admin
 
Posts: 5494
Founded: Antiquity
Inoffensive Centrist Democracy

Postby Ballotonia » Tue May 29, 2012 5:57 pm

[violet] wrote:
Fischistan wrote:Could you make this have a feature to search for regions without a tag? Like q=regionsbytags;tags=world_assembly,-no_sc_campaignign

You see, Ballo, you give them a feature and they want more... more... always more!


Yeah, but asking is the easiest way to get things implemented.

Added: http://www.nationstates.net/cgi-bin/api ... -minuscule

Requirement for use is starting off with at least one tag which doesn't have a "-" (technical reasons, this way it doesn't weigh too heavy on the server).

Ballotonia
"Een volk dat voor tirannen zwicht zal meer dan lijf en goed verliezen, dan dooft het licht…" -- H.M. van Randwijk

User avatar
Fischistan
Ambassador
 
Posts: 1384
Founded: Oct 16, 2011
Ex-Nation

Postby Fischistan » Tue May 29, 2012 6:23 pm

Ballotonia wrote:
[violet] wrote:You see, Ballo, you give them a feature and they want more... more... always more!


Yeah, but asking is the easiest way to get things implemented.

Added: http://www.nationstates.net/cgi-bin/api ... -minuscule

Requirement for use is starting off with at least one tag which doesn't have a "-" (technical reasons, this way it doesn't weigh too heavy on the server).

Ballotonia

I love you Ballotonia! :hug:
Xavier D'Montagne
Fischistani Ambassador to the WA
Unibot II wrote:It's Carta. He CANNOT Fail. Only successes in reverse.
The Matthew Islands wrote:Knowledge is knowing the Tomato is a fruit. Wisdom is knowing not to put it in a fruit salad.
Anthony Delasanta wrote:its was not genocide it was ethnic cleansing...
Socorra wrote:A religion-free abortion thread is like a meat-free hamburger.
Help is on its Way: UDL
Never forget 11 September.
Never look off the edge of cliff on a segway.

11 September 1973, of course.

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

Postby Zemnaya Svoboda » Tue May 29, 2012 10:42 pm

Ballotonia wrote:
[violet] wrote:You see, Ballo, you give them a feature and they want more... more... always more!


Yeah, but asking is the easiest way to get things implemented.

Added: http://www.nationstates.net/cgi-bin/api ... -minuscule

Requirement for use is starting off with at least one tag which doesn't have a "-" (technical reasons, this way it doesn't weigh too heavy on the server).

Ballotonia


An excellent improvement :)

User avatar
Ballotonia
Senior Admin
 
Posts: 5494
Founded: Antiquity
Inoffensive Centrist Democracy

Postby Ballotonia » Sun Jun 03, 2012 11:42 pm

It escapes me who asked for this, and I don't have time right now to re-read the thread to find out, but added to the API:

http://www.nationstates.net/cgi-bin/api ... happenings

Ballotonia
"Een volk dat voor tirannen zwicht zal meer dan lijf en goed verliezen, dan dooft het licht…" -- H.M. van Randwijk

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

Postby Zemnaya Svoboda » Fri Jun 08, 2012 9:37 am

Ballotonia wrote:It escapes me who asked for this, and I don't have time right now to re-read the thread to find out, but added to the API:

http://www.nationstates.net/cgi-bin/api ... happenings

Ballotonia


Zemnaya Svoboda wrote:
Ballotonia wrote:
I do not recall that, but I'll be happy to dive into this and see what I can dig up.



Oh... the great shoving-things-in-my-direction has started :P

That's cool, it leaves you more time to focus on the Telegram System rework. Win-win!

Ballotonia

:bow:

I came here to ask about WA happenings, and was happy to see it'd already been asked :)


edit2: I show some pre-emptive gratitude.


But it was originally by...
Solm wrote:[violet], do you think it would be possible to add a shard for the WA recent events? Similar to the region shard for regional happenings, but for WA recent events? It would make things much easier so I don't have to scrape the WA page just to get the recent events there.

Thank You!


And thank you thank you! :bow:

User avatar
Scoochi2
Envoy
 
Posts: 207
Founded: Antiquity
Ex-Nation

Postby Scoochi2 » Mon Jun 11, 2012 2:33 am

Ballotonia wrote:It escapes me who asked for this, and I don't have time right now to re-read the thread to find out, but added to the API:

http://www.nationstates.net/cgi-bin/api ... happenings

Ballotonia

Great! But any chance the pretitles could be dropped when nations CTE?
for example, instead of "The Dictatorship of Aaronopolis ceased to exist." could to go to "@@aaronopolis@@ ceased to exist." to match up with the other nation events?
The problem with a UDP joke is that you have no idea if people got it.

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

Postby [violet] » Tue Jun 12, 2012 5:45 pm

Scoochi2 wrote:Great! But any chance the pretitles could be dropped when nations CTE?

It's not, at least not without changing how we store that information going forward. When a nation ceases to exist, we log it as plain text, not as a @@tag@@, because it's not going to load anyhow, and we want its full name to display.

There are downsides to this, and arguably it should be a tag. But it's not an API issue, it's a deeper game issue.
Last edited by [violet] on Tue Jun 12, 2012 5:45 pm, edited 1 time in total.

User avatar
Hyanygo
Secretary
 
Posts: 38
Founded: Mar 09, 2007
Civil Rights Lovefest

Postby Hyanygo » Fri Jun 15, 2012 6:40 am

1) I'm trying to find the nations that have become WA members in the last "X" days (in a specific region). I have a feeling that there is no reliable way to do this because the WA membership "signaller" happens in the "happenings" and this gets filled with legislation etc. Am I right?

2) An actual question What does the values in TIMESTAMP actually signify? For example, I have:

Code: Select all
<EVENT>
<TIMESTAMP>1339391669</TIMESTAMP>
<TEXT>
@@hyanygo@@ was ranked in the Top 10% of the region for Largest Mining Sector.
</TEXT>
</EVENT>

User avatar
Ballotonia
Senior Admin
 
Posts: 5494
Founded: Antiquity
Inoffensive Centrist Democracy

Postby Ballotonia » Fri Jun 15, 2012 8:07 am

Hyanygo wrote:1) I'm trying to find the nations that have become WA members in the last "X" days (in a specific region). I have a feeling that there is no reliable way to do this because the WA membership "signaller" happens in the "happenings" and this gets filled with legislation etc. Am I right?

2) An actual question What does the values in TIMESTAMP actually signify? For example, I have:

Code: Select all
<EVENT>
<TIMESTAMP>1339391669</TIMESTAMP>
<TEXT>
@@hyanygo@@ was ranked in the Top 10% of the region for Largest Mining Sector.
</TEXT>
</EVENT>


1: There is no way to obtain that information instantly, as the game doesn't keep a (public) record of who joined the WA at which time. However, if you were to store prior information, then this is possible to do this as a post-processing (using a script) step. Using the Nation Daily Data Dump you can see who is a WA member now. Using the same data dump from X days ago (and that's where you'd need to plan ahead and store these things) and comparing the list of WA nations in it, you could determine a list of nations which are WA members now but weren't X days ago.

2: That's a Unix time stamp. See: http://www.unixtimestamp.com/index.php
This particular one means, in EST: "06 / 11 / 12 @ 12:14:29am EST"

Ballotonia
"Een volk dat voor tirannen zwicht zal meer dan lijf en goed verliezen, dan dooft het licht…" -- H.M. van Randwijk

User avatar
Johz
Negotiator
 
Posts: 5452
Founded: Jan 26, 2010
Ex-Nation

Postby Johz » Tue Jul 10, 2012 6:10 am

A quick query here: With most api calls, the xml tag associated with that call is the same. Take the 'govt' call, which produces the <GOVT></GOVT> tag in the generated xml file.

However, some api calls have a different xml tag. However the 'wa' call produces the <UNSTATUS></UNSTATUS> tags.

While if you're looking for the specific 'wa' shard you can then compensate for that, if you're looking for a general shard this can be irritating. I can compensate for it, but it's not overly helpful that I don't know where this error's going to happen.

So, can you a) normalise all of the shard/xml parings, or b) tell me which shards are going to have this problem?

Thanks, Johz
Always Ready (With a Cuppa): UDL
Praise [violet] for safe switching!

The Village of Johz - (Factbook)
Head of Foreign Affairs:
Mr Newman
Head of the Flower Rota: Mrs Figgis
Population: 269 (Johzians)
Sometime between when the "evolution is just a theory" nonesense dies out, and when Ashmoria starts using captitalization. - EnragedMaldivians
It's called a tangent. It tends to happen on NSG. - Olthar
[E]very Brit I've met on the internet has been violently apathetic. - Conserative Morality
This is Johz. I'd like to give him a hug someday. - Celly
See a mistake? Send me a telegram!|I would be very much indebted to you.
LINKS: My Website|Barryman|Gay Marriage: Who will be next?

#NSG on esper.net - Join us!
Also, bonobos zygons.

User avatar
Ballotonia
Senior Admin
 
Posts: 5494
Founded: Antiquity
Inoffensive Centrist Democracy

Postby Ballotonia » Tue Jul 10, 2012 9:47 am

The idea is that a shard produces the same output as is in the XML data dump. If you find any discrepancies, please do let us know.

Ballotonia
"Een volk dat voor tirannen zwicht zal meer dan lijf en goed verliezen, dan dooft het licht…" -- H.M. van Randwijk

User avatar
Johz
Negotiator
 
Posts: 5452
Founded: Jan 26, 2010
Ex-Nation

Postby Johz » Tue Jul 10, 2012 12:28 pm

Ballotonia wrote:The idea is that a shard produces the same output as is in the XML data dump. If you find any discrepancies, please do let us know.

Ballotonia

Well, there's that one I posted above, which is presumably a relic from the days of the UN.

All of the custom titles are also affected. I'm not sure if this is simply because testlandia has no custom titles defined, but customleader, customcapital, customreligion.

Nothing in the region method is affected, I don't think.

The World API only has one oddity: regionsbytags is different to the REGIONS xml tag.

The resolution+delvotes shard has two xml tags (DELVOTES_FOR and DELVOTES_AGAINST) but no actual DELVOTES.

I think that's all of the oddities in total. I realise some people have already got their own ways of dealing with this (Eluvatar just had a go at me on IRC) but is at possible to sort this out in a new API version? Or does no-one actually append that onto their calls?
Always Ready (With a Cuppa): UDL
Praise [violet] for safe switching!

The Village of Johz - (Factbook)
Head of Foreign Affairs:
Mr Newman
Head of the Flower Rota: Mrs Figgis
Population: 269 (Johzians)
Sometime between when the "evolution is just a theory" nonesense dies out, and when Ashmoria starts using captitalization. - EnragedMaldivians
It's called a tangent. It tends to happen on NSG. - Olthar
[E]very Brit I've met on the internet has been violently apathetic. - Conserative Morality
This is Johz. I'd like to give him a hug someday. - Celly
See a mistake? Send me a telegram!|I would be very much indebted to you.
LINKS: My Website|Barryman|Gay Marriage: Who will be next?

#NSG on esper.net - Join us!
Also, bonobos zygons.

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

Postby [violet] » Tue Jul 10, 2012 9:11 pm

What B is getting at is that the daily dumps are only produced in the latest version number, so we can't change those without insta-breaking the tools of everyone who relies on them. We can update the API, but then we have the situation where the same data is tagged differently in the dumps versus the API. Which seems just as annoying as having the tags not always match the shard names.

There are some situations, such as 'customleader', where I don't think there's a good reason for the discrepancy (i.e. they're not in the daily dumps), so we could change those fairly painlessly.

PreviousNext

Advertisement

Remove ads

Return to Technical

Who is online

Users browsing this forum: No registered users

Advertisement

Remove ads