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
[violet]
Executive Director
 
Posts: 16205
Founded: Antiquity

Postby [violet] » Mon Nov 07, 2016 4:29 pm

HMS Unicorn wrote:The MEMBERLOG shard of the World Assembly API seems to have stopped updating.

Thanks, yes, it broke. Since Happenings, "memberlog" has been a standalone and fully redundant system, so I'm not going to fix it. For now I've made it return the same info as "q=happenings;filter=member" and in the future I'll remove it altogether.

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

Postby [violet] » Mon Nov 07, 2016 4:37 pm

Greater Tern wrote:
Greater Tern wrote:Bug report: for the current SC resolution, the "REPEALS_COUNCILD" field isn't being returned. It should return "207" -- pointing to the SC resolution being repealed.

The same thing seems to be happening to the current GA resolution -- REPEALS_COUNCILD isn't included in the XML returned (REPEALS_COUNCILD should be 385).

Neither of the resolutions at vote are repeals at the moment so I can't see the problem. Was there a REPEALS_COUNCILD field (missing an "I")?

User avatar
Greater Tern
Envoy
 
Posts: 331
Founded: Mar 04, 2010
Civil Rights Lovefest

Postby Greater Tern » Mon Nov 07, 2016 5:31 pm

[violet] wrote:Neither of the resolutions at vote are repeals at the moment so I can't see the problem.


The active resolutions at the time of posting were repeal resolutions, namely SC #208 and GA #387 respectively. Looks like the API is properly returning it on old resolutions as "REPEALS_COUNCILID", but it wasn't showing up for active resolutions.

[violet] wrote:Was there a REPEALS_COUNCILD field (missing an "I")?


Yep, that's how it was spelled when it was added:

[violet] wrote:Added these to repeals: <REPEALS_COUNCILD> and <REPEALS_RESID>.


You can see it in SC #204, but looking at SC #208 above it's now spelled "REPEALS_COUNCILID". Would it be possible to make this consistent?

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

Postby [violet] » Mon Nov 07, 2016 8:16 pm

Ah ok. A typo crept in there. It's supposed to be REPEALS_COUNCILID. I'll sync those up.

User avatar
Greater Tern
Envoy
 
Posts: 331
Founded: Mar 04, 2010
Civil Rights Lovefest

Postby Greater Tern » Mon Nov 07, 2016 8:50 pm

[violet] wrote:Ah ok. A typo crept in there. It's supposed to be REPEALS_COUNCILID. I'll sync those up.

Thanks [violet]! One more thing -- not sure if it's intentional, but it seems that the values returned by REPEALS_COUNCILID are off by 1. (I'm guessing the resolutions are zero-indexed?)

User avatar
Melorian Republic
Spokesperson
 
Posts: 126
Founded: Jan 25, 2016
Ex-Nation

Postby Melorian Republic » Thu Nov 24, 2016 1:16 pm

Just curious: are there any JavaScript NS API parsers out there? I only seem to see Java and Python and others.
Superbia in proelia!

The Melorian Republic


User avatar
Auralia
Senator
 
Posts: 4982
Founded: Dec 15, 2011
Ex-Nation

Postby Auralia » Thu Nov 24, 2016 2:47 pm

Melorian Republic wrote:Just curious: are there any JavaScript NS API parsers out there? I only seem to see Java and Python and others.

Yes!
Catholic Commonwealth of Auralia
"Amor sequitur cognitionem."

User avatar
Melorian Republic
Spokesperson
 
Posts: 126
Founded: Jan 25, 2016
Ex-Nation

Postby Melorian Republic » Thu Nov 24, 2016 4:02 pm

Auralia wrote:
Melorian Republic wrote:Just curious: are there any JavaScript NS API parsers out there? I only seem to see Java and Python and others.

Yes!


Thank you! This is what I needed.
Superbia in proelia!

The Melorian Republic


User avatar
Greater Tern
Envoy
 
Posts: 331
Founded: Mar 04, 2010
Civil Rights Lovefest

Postby Greater Tern » Sun Nov 27, 2016 2:18 pm

Hey [violet], thanks for the fixes on REPEALS_COUNCILID. However, it's still not showing up for active repeal resolutions. See the API response for the SC repeal resolution at vote: https://www.nationstates.net/cgi-bin/ap ... resolution

Compared to SC #204: https://www.nationstates.net/cgi-bin/ap ... resolution

REPEALS_COUNCILID is returned for SC #204, but it doesn't show up for the active resolution.

User avatar
Zora Imperium
Civilian
 
Posts: 1
Founded: Nov 18, 2016
Ex-Nation

Postby Zora Imperium » Sun Dec 04, 2016 9:51 pm

Idk where this goes I'm sorry, but where can I apply for a Client Key to recruit for my region?

User avatar
Greater Tern
Envoy
 
Posts: 331
Founded: Mar 04, 2010
Civil Rights Lovefest

Postby Greater Tern » Sun Dec 04, 2016 10:09 pm

Zora Imperium wrote:Idk where this goes I'm sorry, but where can I apply for a Client Key to recruit for my region?

File a GHR.

User avatar
Agadar
Powerbroker
 
Posts: 7784
Founded: Dec 06, 2009
Psychotic Dictatorship

Postby Agadar » Thu Dec 08, 2016 1:26 pm

Is there an easier way to retrieve regional happenings during a specific time period (say, last month) besides discovering the id of the first happening of the first day of said specific time period using the included timestamp and then iterating until the ending timestamp has been reached?

If not, would it be possible for timestamp-filtering to be made available for happenings? A similar feature is already supported for the nation history shard (it supports a 'from' and 'to' option, taking timestamps).

The reason I'd like to be able to select happenings by timestamps is because I'd like to discover programmatically how many endorsements people have given each month.
Last edited by Agadar on Thu Dec 08, 2016 1:27 pm, edited 1 time in total.
Proud resident of The Western Isles, the #1 role-playing region!
Developer of Telegrammer, NS API Java Wrapper, and more!

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

Postby [violet] » Thu Dec 08, 2016 4:36 pm

"beforetime" and "sincetime" parameters are now supported in the Happenings API. See the doc for examples.

User avatar
Agadar
Powerbroker
 
Posts: 7784
Founded: Dec 06, 2009
Psychotic Dictatorship

Postby Agadar » Thu Dec 08, 2016 5:00 pm

[violet] wrote:"beforetime" and "sincetime" parameters are now supported in the Happenings API. See the doc for examples.


Neat. That certainly saves a lot of headache: I still have to make multiple calls and keep track of the last event id, but at least I don't have to manually check for the beginning-and ending timestamps now. Thanks!
Proud resident of The Western Isles, the #1 role-playing region!
Developer of Telegrammer, NS API Java Wrapper, and more!

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

Postby HMS Unicorn » Tue Dec 13, 2016 3:46 am

[violet] wrote:"beforetime" and "sincetime" parameters are now supported in the Happenings API. See the doc for examples.

Very useful. I've been meaning to ask for this for a while now (but I kept being lazy and just coding various workarounds instead...).

I will work to update several parts of my code that can benefit from this, and report back any issues.

Thanks a lot!

User avatar
Melorian Republic
Spokesperson
 
Posts: 126
Founded: Jan 25, 2016
Ex-Nation

Postby Melorian Republic » Fri Dec 23, 2016 3:41 pm

There doesn't seem to be a shard to track influence changes in a region. Is that a planned thing, or not?
Last edited by Melorian Republic on Fri Dec 23, 2016 3:52 pm, edited 1 time in total.
Superbia in proelia!

The Melorian Republic


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

Postby HMS Unicorn » Tue Dec 27, 2016 7:17 pm

Were plain http (as opposed to secure https) calls disabled for the API?

It looks like http API calls now redirect to https, instead of returning the API call results. This seems to have started happening about an hour ago.

I was originally going to mark this as a bug report, but I realize it may be a planned development.
Last edited by HMS Unicorn on Tue Dec 27, 2016 8:34 pm, edited 2 times in total.


User avatar
Imperium Anglorum
GA Secretariat
 
Posts: 12655
Founded: Aug 26, 2013
Left-Leaning College State

Postby Imperium Anglorum » Thu Dec 29, 2016 9:38 am

The API documentation probably ought be updated to use HTTPS instead of HTTP.

Author: 1 SC and 56+ GA resolutions
Maintainer: GA Passed Resolutions
Developer: Communiqué and InfoEurope
GenSec (24 Dec 2021 –); posts not official unless so indicated
Delegate for Europe
Elsie Mortimer Wellesley
Ideological Bulwark 285, WALL delegate
Twice-commended toxic villainous globalist kittehs

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

Postby [violet] » Thu Dec 29, 2016 5:57 pm

Yes, done, thanks.

User avatar
Krypton Nova
Diplomat
 
Posts: 514
Founded: Jun 01, 2015
Left-wing Utopia

Postby Krypton Nova » Sun Jan 01, 2017 6:46 am

I hope this is the right place to ask this :)

I can't seem to get data between two timestamps when it exceeds a certain amount of items.

For example this
https://www.nationstates.net/cgi-bin/ap ... 1483167600
gives me all nations who CTE'd during that period with the earliest being 1483165833 and the latest being 1483166399 (full timespan)

But this, which contains far more data over the same amount of time:
https://www.nationstates.net/cgi-bin/ap ... 1483167600
only gives me nation's legislation starting with the earliest being 1483167435 and the latest being 1483167596 (only the last 2 minutes)

How would I go about collecting the data between those timestamps in the second case? Should I make multiple smaller requests
with shorter time-spans, or is there a better way to get all data within one request?
Last edited by Krypton Nova on Sun Jan 01, 2017 6:47 am, edited 1 time in total.
Member of the The LCRUA.

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

Postby Trotterdam » Sun Jan 01, 2017 9:55 am

Check the earliest timestamp that actually got returned, then make your next call asking about events preceding that timestamp.

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

Postby HMS Unicorn » Sun Jan 01, 2017 10:22 pm

You can also add limit=200 to the URL, to increase the number of events returned (the default is 100), and therefore decrease the number of API calls you need to make.

https://www.nationstates.net/cgi-bin/api.cgi?q=happenings;filter=cte;sincetime=1483160400;beforetime=1483167600;limit=200

User avatar
Krypton Nova
Diplomat
 
Posts: 514
Founded: Jun 01, 2015
Left-wing Utopia

Postby Krypton Nova » Mon Jan 02, 2017 7:47 am

HMS Unicorn wrote:You can also add limit=200 to the URL, to increase the number of events returned (the default is 100), and therefore decrease the number of API calls you need to make.

https://www.nationstates.net/cgi-bin/api.cgi?q=happenings;filter=cte;sincetime=1483160400;beforetime=1483167600;limit=200
Trotterdam wrote:Check the earliest timestamp that actually got returned, then make your next call asking about events preceding that timestamp.


I see... I'll work with that then.
Thanks for the help :)
Member of the The LCRUA.

User avatar
Gyflada
Diplomat
 
Posts: 996
Founded: Jun 10, 2010
Democratic Socialists

Postby Gyflada » Sun Jan 08, 2017 11:14 am

For some reason, I can't create a new recruitment telegram.

I have all of the information I need, but when I go to create the telegram, tag it as API and mark it as a recruitment telegram for my region, it says my nation insn't allowed to recruitment for region.

Any ideas?
Please refer to my nation IC as the Kingdom of Edom or Edom.

Diplomacy: Factbook | Embassy Programme | Everyday Productions [News] | International Aid & Development
Economcs & Trade: Majestic Hotel & Majestic Corporation

PreviousNext

Advertisement

Remove ads

Return to Technical

Who is online

Users browsing this forum: Billyabna, Buretes, De Anarchy Le Co, Demyis, Dharmasya, Great-Desolates, Lord Dominator, North American Imperial State, Viviane

Advertisement

Remove ads