Advertisement

by Rovhania » Sat Sep 05, 2026 7:38 pm
I like Phil.
— Quebecshire
I like Phil, I’m so glad he (I think) escaped
— Croblade
government should be run by good phils
— Differences-in-Differences
phil: an ongoing example of positivity in NSGP
— Kalavakus

by Llan » Sat Sep 05, 2026 7:40 pm

by Valentine Z » Fri Sep 18, 2026 11:02 am
♪ If you are reading my sig, I want you to have the best day so far ! 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 !
(✿◠‿◠) ☆ \(^_^)/ ☆
♡ Issues Thread ♡ Photography Stuff ♡ Project: Save F7. ♡ Stats Analysis ♡
♡ The Sixty! ♡ Valentian Stories! ♡ Gwen's Adventures! ♡
• Never trouble trouble until trouble troubles you.
• World Map is a cat playing with Australia.

by Merethin » Fri Sep 18, 2026 11:33 am
Valentine Z wrote:By chance, is there an API call that will allow you to have data points of the stats since 2016? Like historical data points.
Though of course, this is a VERY tall order, I am aware of that. With the NS stats trend starting off around Feb 28 2016, that will be 3856 data points (and counting) per stat, per nation.

by Valentine Z » Sat Sep 19, 2026 2:52 am
Merethin wrote:Valentine Z wrote:By chance, is there an API call that will allow you to have data points of the stats since 2016? Like historical data points.
Though of course, this is a VERY tall order, I am aware of that. With the NS stats trend starting off around Feb 28 2016, that will be 3856 data points (and counting) per stat, per nation.
https://www.nationstates.net/cgi-bin/api.cgi?nation=valentine_z&q=census&mode=history&scale=ID, optionally add from={} and to={} with UNIX timestamps. Seems like scale=all is also possible but it (understandably) takes quite a long time to fetch.
From the docs: https://www.nationstates.net/pages/api. ... i-standard
♪ If you are reading my sig, I want you to have the best day so far ! 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 !
(✿◠‿◠) ☆ \(^_^)/ ☆
♡ Issues Thread ♡ Photography Stuff ♡ Project: Save F7. ♡ Stats Analysis ♡
♡ The Sixty! ♡ Valentian Stories! ♡ Gwen's Adventures! ♡
• Never trouble trouble until trouble troubles you.
• World Map is a cat playing with Australia.

by [violet] » Wed Sep 30, 2026 9:09 pm
Agadar wrote:I also see that the mostliked, mostlikes, and mostposts shards have been removed from the documentation, but they can still be accessed. Are they pending to be removed, or is the documentation simply not up to date?

by [violet] » Thu Oct 01, 2026 1:37 pm
If your bot repeatedly polls other APIs for happenings, please migrate to the Live Happenings SSE API.

by Dhornaper » Thu Oct 01, 2026 1:55 pm
[violet] wrote:Live Happenings SSE API: Please Use It
I've updated the NS API doc, including adding this line:If your bot repeatedly polls other APIs for happenings, please migrate to the Live Happenings SSE API.
The Live Happenings SSE API is now officially out of beta and the recommended source for bots that want to monitor happenings in real time. The most common form of these are Discord bots and scripts that check for new foundings and region moves. Previously, the only way to do this was to repeatedly send the same query to the NS API and watch for changes; now you can get the Live Happenings SSE API to send you events as they happen.
Currently just 7 bots account for more than three-quarters of all such rapid-polling happenings traffic, so it would be great to shift them over to the much more efficient SSE. At some point in the future, I'll make this mandatory, i.e. bots will not be permitted to rapidly poll the other APIs for happenings.
There is a migration guide in the doc.
BIG UP TONY BLAIR |
by Trotterdam » Thu Oct 01, 2026 11:57 pm
Uh, does this include me?[violet] wrote:Currently just 7 bots account for more than three-quarters of all such rapid-polling happenings traffic, so it would be great to shift them over to the much more efficient SSE. At some point in the future, I'll make this mandatory, i.e. bots will not be permitted to rapidly poll the other APIs for happenings.

by Aidenfieeld » Sat Oct 03, 2026 4:40 pm
[violet] wrote:Agadar wrote:I also see that the mostliked, mostlikes, and mostposts shards have been removed from the documentation, but they can still be accessed. Are they pending to be removed, or is the documentation simply not up to date?
They were added ten years ago as "experimental and undocumented" features and promptly forgotten about.
Investigating now, I see they are barely used and horrifyingly inefficient ("mostposts" can take over 20 minutes per request), so I'll remove them.


by [violet] » Sat Oct 03, 2026 5:32 pm

by [violet] » Sat Oct 03, 2026 5:34 pm
Aidenfieeld wrote:The region I'm from (TSP) has a well-established RMB awards program that is only made possible by making API pulls using the mostposts, mostliked, and mostlikes shards.

by [violet] » Sat Oct 03, 2026 5:38 pm
[violet] wrote:The Live Happenings SSE API isn't meant to be a general replacement for everything else. It's just for bots that want to monitor NS Happenings and react to them.
...
Essentially:
- If your bot rapidly requests the same Happenings from NS over and over just to see if anything changed, it should use the Live Happenings SSE API instead. An example would be a discord bot that wants to notify people in a channel that something just happened on NS.
- If your bot doesn't do anything until someone asks it to look something up, it should probably use the regular APIs. But if it's very active, it should consider a cache.

by Aidenfieeld » Sat Oct 03, 2026 5:39 pm

by [violet] » Tue Oct 06, 2026 9:42 pm

by New Rogernomics » Thu Oct 08, 2026 5:26 pm

by New Rogernomics » Sat Oct 10, 2026 12:13 am
If it can't repeat, then potentially even having it added once via an SSE event would be ideal. Right now, I'm doing it by having it monitor SSE events for a vote on a new resolution, then it is running the API request then in response to that and getting the text. Gradually working to improve my SSE monitoring so that is only off by a few votes and doesn't need to make a request at all.[violet] wrote:Say more? An SSE server generally wouldn't send repeat events because that undermines the concept. It's meant to broadcast changes.



by [violet] » Sat Oct 10, 2026 10:25 pm
New Rogernomics wrote:Right now, I'm doing it by having it monitor SSE events for a vote on a new resolution, then it is running the API request then in response to that and getting the text.

by Merethin » Sun Oct 11, 2026 3:22 am
New Rogernomics wrote:If it can't repeat, then potentially even having it added once via an SSE event would be ideal.
The (General Assembly|Security Council) proposal "(.+)" \(by @@([0-9a-z_-]+)@@((?:,?( and)? @@([0-9a-z_-]+)@@)*)?\) entered the resolution voting floor
by UPC » Sun Oct 11, 2026 8:43 am

by Toerana » Sun Oct 11, 2026 9:29 am

by The Western Union of Communitas » Sun Oct 11, 2026 1:50 pm
[violet] wrote:Trotterdam wrote:Uh, does this include me?
No -- Gloomspider is a very active bot, but it doesn't rapidly poll the same Happenings shard over and over.
The seven bots I mentioned request the same Happenings shard(s) every few seconds, and so are better suited to the Live Happenings SSE API: Dhornaper's discord bot, East Durthang's Telegramer/Stats Collector, the Echo discord bot used by Lazarus, Altys's discord bot, The Western Union of Communitas, Unibot's Rainmaker, and Wintermoot's Wintreath.


by [violet] » Sun Oct 11, 2026 4:32 pm
Toerana wrote:we used the mostposts/likes/etc endpoints
UPC wrote:Euro used this endpoint for RMB awards, and I wrote a tool for TRR that used it as well way back in the day.

by New Rogernomics » Sun Oct 11, 2026 4:42 pm
That's what I already monitor, yep. If my bot restarts/starts it will do an API request to refresh the vote tallies while SSE monitoring is starting up.Merethin wrote:New Rogernomics wrote:If it can't repeat, then potentially even having it added once via an SSE event would be ideal.
There is an SSE event for when a resolution goes to vote, if that's what you mean:
- Code: Select all
The (General Assembly|Security Council) proposal "(.+)" \(by @@([0-9a-z_-]+)@@((?:,?( and)? @@([0-9a-z_-]+)@@)*)?\) entered the resolution voting floor
I think that the idea of sending the resolution text along with it isn't a bad one; we already got the rmbMessage field on RMB posts so it could be cool to see that concept extended to more SSE events.
Advertisement
Users browsing this forum: Jonas Land
Advertisement