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
Rich and Corporations
Negotiator
 
Posts: 6560
Founded: Aug 09, 2004
Ex-Nation

Postby Rich and Corporations » Wed Aug 20, 2014 5:17 pm

Glen-Rhodes wrote:@Rich and Corporations: you're passing strings, not constants. Get rid of the apostrophes. Also, that's more of a general PHP question, and not an NS API question...

I'm sorry. I do make php questions from time to time here anyway though.

User avatar
Tribes Republic
Ambassador
 
Posts: 1166
Founded: Jun 15, 2012
Democratic Socialists

Postby Tribes Republic » Mon Aug 25, 2014 3:15 pm

Does the NS API should work with Microsoft's Visual Studio 2013, because I have all three Express versions Web, Windows, and Desktop
Nation Leader: Principal Chief Giltra Hurid
WA Ambassador: Leui Henri
Nation Name: The Colony of Tribes Republic
RP Population: 64.1 Million(UK Pop as of 2013)
Nation Tech: PT, MT, PMT

My Political Compass
Economic Left/Right: 3.25
Social Libertarian/Authoritarian: -2.21

This is Bunny:
(\__/)
(='.'=)
(")_(") Copy and paste Bunny into your signature to help him gain world domination.
(5)At War
(4)Troops On Standby
(3)Ready<--
(2)High Alert
(1)Peace
[url]new link coming soon[/url]

User avatar
Rich and Corporations
Negotiator
 
Posts: 6560
Founded: Aug 09, 2004
Ex-Nation

Postby Rich and Corporations » Mon Aug 25, 2014 4:34 pm

Tribes Republic wrote:Does the NS API should work with Microsoft's Visual Studio 2013, because I have all three Express versions Web, Windows, and Desktop

Yes, I believe you can make a web request using Visual Studio.
Corporate Confederacy
DEFENSE ALERT LEVEL
PEACE WAR

Factbook [url=iiwiki.com/wiki/Corporate_Confederacy]Wiki Article[/url]
Neptonia

User avatar
Tribes Republic
Ambassador
 
Posts: 1166
Founded: Jun 15, 2012
Democratic Socialists

Postby Tribes Republic » Mon Aug 25, 2014 5:35 pm

Rich and Corporations wrote:
Tribes Republic wrote:Does the NS API should work with Microsoft's Visual Studio 2013, because I have all three Express versions Web, Windows, and Desktop

Yes, I believe you can make a web request using Visual Studio.


I may have to use VS for Web 2013, but it uses Microsoft Azure so I may have to write a workaround for that
Nation Leader: Principal Chief Giltra Hurid
WA Ambassador: Leui Henri
Nation Name: The Colony of Tribes Republic
RP Population: 64.1 Million(UK Pop as of 2013)
Nation Tech: PT, MT, PMT

My Political Compass
Economic Left/Right: 3.25
Social Libertarian/Authoritarian: -2.21

This is Bunny:
(\__/)
(='.'=)
(")_(") Copy and paste Bunny into your signature to help him gain world domination.
(5)At War
(4)Troops On Standby
(3)Ready<--
(2)High Alert
(1)Peace
[url]new link coming soon[/url]

User avatar
Tribes Republic
Ambassador
 
Posts: 1166
Founded: Jun 15, 2012
Democratic Socialists

Postby Tribes Republic » Tue Aug 26, 2014 9:28 am

Code: Select all

            // Uncomment the following lines to enable logging in with third party login providers
            //app.UseMicrosoftAccountAuthentication(
            //    clientId: "",
            //    clientSecret: "");

            //app.UseTwitterAuthentication(
            //    consumerKey: "",
            //    consumerSecret: "");

            //app.UseFacebookAuthentication(
            //    appId: "",
            //    appSecret: "");

            //app.UseGoogleAuthentication(new GoogleOAuth2AuthenticationOptions()
            //{
            //    ClientId = "",
            //    ClientSecret = ""
            //});
        }
    }
}



where would the NS authentication go this is Visual C# 2013, would I be able to just change one of the ones for Google, Facebook, or Twitter and there shouldn't be a problem
Nation Leader: Principal Chief Giltra Hurid
WA Ambassador: Leui Henri
Nation Name: The Colony of Tribes Republic
RP Population: 64.1 Million(UK Pop as of 2013)
Nation Tech: PT, MT, PMT

My Political Compass
Economic Left/Right: 3.25
Social Libertarian/Authoritarian: -2.21

This is Bunny:
(\__/)
(='.'=)
(")_(") Copy and paste Bunny into your signature to help him gain world domination.
(5)At War
(4)Troops On Standby
(3)Ready<--
(2)High Alert
(1)Peace
[url]new link coming soon[/url]

User avatar
Southern Ageena
Bureaucrat
 
Posts: 56
Founded: Apr 16, 2013
Ex-Nation

Postby Southern Ageena » Thu Aug 28, 2014 11:37 am

Any chance we could get a nation's nation analysis values? For example obesity, niceness etc.Never mind, I'm an idiot.
Last edited by Southern Ageena on Thu Aug 28, 2014 11:48 am, edited 1 time in total.
Head judge on the Genuan Rebirth supreme court (second term);
Current Minister of Law Genuan Rebirth (dree terme);
Former Minister of Foreign Affairs Genuan Rebirth;
Founder Beyond the Superpowers of Earth;
Founder Genua

Pro Socialism

User avatar
Unibot III
Negotiator
 
Posts: 7114
Founded: Mar 11, 2011
Democratic Socialists

Postby Unibot III » Mon Sep 08, 2014 5:59 pm

I don't see a shard for poll data -- that would be helpful for us to track the progression of polls.
[violet] wrote:I mean this in the best possible way,
but Unibot is not a typical NS player.
Milograd wrote:You're a caring, resolute lunatic
with the best of intentions.
Org. Join Date: 25-05-2008 | Former Delegate of TRR

Factbook // Collected works // Gameplay Alignment Test //
9 GA Res., 14 SC Res. // Headlines from Unibot // WASC HQ: A Guide

▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
✯ Duty is Eternal, Justice is Imminent: UDL

User avatar
Rich and Corporations
Negotiator
 
Posts: 6560
Founded: Aug 09, 2004
Ex-Nation

Postby Rich and Corporations » Mon Sep 08, 2014 6:23 pm

Unibot III wrote:I don't see a shard for poll data -- that would be helpful for us to track the progression of polls.

I second this.
Corporate Confederacy
DEFENSE ALERT LEVEL
PEACE WAR

Factbook [url=iiwiki.com/wiki/Corporate_Confederacy]Wiki Article[/url]
Neptonia

User avatar
Upska
Lobbyist
 
Posts: 21
Founded: Aug 30, 2011
Psychotic Dictatorship

Legislation shard lacking

Postby Upska » Sun Sep 14, 2014 4:51 am

Why does the legislation shard only contain the four last legislations if it is possible to have five new ones in one day by saving up your issues? This would mean that some nations would have one legislation missing in the API every 2-3 days.

User avatar
Lordieth
Post Czar
 
Posts: 31603
Founded: Jun 18, 2010
New York Times Democracy

Postby Lordieth » Wed Sep 17, 2014 5:07 am

I'm really rusty on the API, but I want to write a new recruitment script. Has the process changed much since the new system was created with TG templates the like? I've also lost my API key. Can I just send a GHR to get that?

One specific question; when sending a recruitment TG, how often until we can TG that nation again? I'm going to record TGs sent in a DB of sorts with timestamps, and I'll want to prune it periodically, as I'll be constantly querying it to ensure I don't TG the same nation more than once when I poll the API for new nations.
Last edited by Lordieth on Wed Sep 17, 2014 5:08 am, edited 1 time in total.
There was a signature here. It's gone now.

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

Postby [violet] » Mon Sep 22, 2014 5:49 pm

Upska wrote:Why does the legislation shard only contain the four last legislations if it is possible to have five new ones in one day by saving up your issues?

Those two numbers are unrelated. You can have up to 5 unaddressed issues and your nation can have up to 4 descriptors generated by passed legislation.

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

Postby [violet] » Mon Sep 22, 2014 6:33 pm

Rich and Corporations wrote:
Unibot III wrote:I don't see a shard for poll data -- that would be helpful for us to track the progression of polls.

I second this.

Poll data is now available via Region and World shards!

Documentation
Region shard example
World shard example

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

Postby [violet] » Mon Sep 22, 2014 6:50 pm

Lordieth wrote:One specific question; when sending a recruitment TG, how often until we can TG that nation again? I'm going to record TGs sent in a DB of sorts with timestamps, and I'll want to prune it periodically, as I'll be constantly querying it to ensure I don't TG the same nation more than once when I poll the API for new nations.

It's 28 days until you can recruit the same nation for the same region. The system will automatically block any more recruitment TGs within that window as "Previous Recruitment Too Recent."

For other API details take a look here.

User avatar
Unibot III
Negotiator
 
Posts: 7114
Founded: Mar 11, 2011
Democratic Socialists

Postby Unibot III » Wed Sep 24, 2014 9:10 am

[violet] wrote:
Rich and Corporations wrote:I second this.

Poll data is now available via Region and World shards!

Documentation
Region shard example
World shard example


Thanks so much [violet]!
[violet] wrote:I mean this in the best possible way,
but Unibot is not a typical NS player.
Milograd wrote:You're a caring, resolute lunatic
with the best of intentions.
Org. Join Date: 25-05-2008 | Former Delegate of TRR

Factbook // Collected works // Gameplay Alignment Test //
9 GA Res., 14 SC Res. // Headlines from Unibot // WASC HQ: A Guide

▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
✯ Duty is Eternal, Justice is Imminent: UDL

User avatar
Larthinian Fast Response Elite Police
Bureaucrat
 
Posts: 43
Founded: Aug 21, 2014
Ex-Nation

Postby Larthinian Fast Response Elite Police » Sat Sep 27, 2014 6:36 am

Excuse me, how am I supposed to use API?

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

Postby HMS Unicorn » Fri Oct 03, 2014 3:43 pm

HMS Unicorn wrote:Would it be possible to add a shard for the nation API producing the list of all factbooks/dispatches that nation has published?

Also, would it be possible to add an API call (not sure where this would go) for fetching a factbook/dispatch by its ID?

Currently, I believe (though I may always be mistaken) that both of these actions can only be done through HTML scraping, which is really inefficient if you need to compile lists of dispatches from multiple nations.

I am still interested in this. Would it be possible to add these shards to the nation API?

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

Postby Eluvatar » Fri Oct 03, 2014 9:03 pm

So, my adventures in encodings have a sequel, the lovely motto changes of Battle Islands

See here:
It wouldn't be visible in this forum if I copied it over, but between the "Fuc" and the "kers" there is a unicode-encoded U+009d character (0xc29d), of which the 0x9d byte is not valid ISO-8859-1.

This of course means that my earlier approach to getting API results safely parsed, based on earlier interesting results, of throwing them into the windows-1252 (ISO-8859-1) decoder, won't work :lol2:

In unicode, U+009d means <control> (as in the Ctrl key).

Two questions:

1. Should mottos with control characters in them be allowed?
2. Is it now safe for me to expect the NS API to return valid UTF+8 (and not ISO-8859-1 which isn't valid UTF+8, as would sometimes happen before)?
To Serve and Protect: UDL

Eluvatar - Taijitu member

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

Postby [violet] » Sat Oct 04, 2014 9:07 pm

Eluvatar wrote:Two questions:

1. Should mottos with control characters in them be allowed?
2. Is it now safe for me to expect the NS API to return valid UTF+8 (and not ISO-8859-1 which isn't valid UTF+8, as would sometimes happen before)?


1. No! As of now, fields cannot contain Unicode Control Characters. Thanks for pointing this out.

2. I believe so, yes. At least, it is right of you to expect valid UTF-8. If you see otherwise, please let me know.

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

Postby [violet] » Sat Oct 04, 2014 10:25 pm

HMS Unicorn wrote:Would it be possible to add a shard for the nation API producing the list of all factbooks/dispatches that nation has published?

I've added this one: see the documentation for some examples, but there are "factbooks" and "dispatches" for the number of each written by that nation, and "factbooklist" and "dispatchlist" for a summary of them.

Also, would it be possible to add an API call (not sure where this would go) for fetching a factbook/dispatch by its ID?

Yes, it would. It can be a World API shard. I presume you want the full text?

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

Postby Eluvatar » Sun Oct 05, 2014 11:20 am

[violet] wrote:
HMS Unicorn wrote:Would it be possible to add a shard for the nation API producing the list of all factbooks/dispatches that nation has published?

I've added this one: see the documentation for some examples, but there are "factbooks" and "dispatches" for the number of each written by that nation, and "factbooklist" and "dispatchlist" for a summary of them.

Also, would it be possible to add an API call (not sure where this would go) for fetching a factbook/dispatch by its ID?

Yes, it would. It can be a World API shard. I presume you want the full text?

I'm not certain about r3n (HMS Unicorn) but I know I would love a factbook API that gave the 'raw' text :)
To Serve and Protect: UDL

Eluvatar - Taijitu member

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

Postby [violet] » Sun Oct 05, 2014 6:00 pm

Eluvatar wrote:I'm not certain about r3n (HMS Unicorn) but I know I would love a factbook API that gave the 'raw' text :)

Added new shards "dispatch" and "dispatchlist": the first one allows looking up full dispatch text by ID, and the second one provides a list of dispatches in a particular category, sorted in a particular way. More info in the doc!

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

Postby Eluvatar » Sun Oct 05, 2014 9:50 pm

[violet] wrote:
Eluvatar wrote:I'm not certain about r3n (HMS Unicorn) but I know I would love a factbook API that gave the 'raw' text :)

Added new shards "dispatch" and "dispatchlist": the first one allows looking up full dispatch text by ID, and the second one provides a list of dispatches in a particular category, sorted in a particular way. More info in the doc!

:bow:
To Serve and Protect: UDL

Eluvatar - Taijitu member

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

Postby HMS Unicorn » Tue Oct 07, 2014 12:45 pm

These are great, thanks a lot!

User avatar
Railana
Diplomat
 
Posts: 518
Founded: Apr 11, 2014
Ex-Nation

Postby Railana » Tue Oct 14, 2014 4:17 pm

I've created a .NET interface for the NationStates API, if anyone's interested.
Dominion of Railana
Also known as Auralia

"Lex naturalis voluntas Dei est."

User avatar
Babylatia
Attaché
 
Posts: 77
Founded: Feb 15, 2014
Ex-Nation

Postby Babylatia » Sat Oct 25, 2014 9:01 pm

When I use the https://www.nationstates.net/cgi-bin/api.cgi?nation=Babylatia with PHP, I get an error with the '&' in 'Law & Order' because it is not '&amp;'.

OOC NEWS: Babylatia has rerelocated to the Renegade Islands Alliance!

IC NEWS: Loading...

And yes, I do have an ego.
Waypool
Class Q17: Tier 5, Type II, Regional power to Class X14: Tier 4, Type II, Superpower

PreviousNext

Advertisement

Remove ads

Return to Technical

Who is online

Users browsing this forum: Bormiar

Advertisement

Remove ads