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
SherpDaWerp
Technical Moderator
 
Posts: 1895
Founded: Mar 02, 2016
Benevolent Dictatorship

Postby SherpDaWerp » Thu Dec 12, 2019 3:44 pm

Can I request a shard that says how much bank a nation has?
It would make management of my farm much easier - I could check how much bank they have without looking through them all.
Became an editor on 18/01/23 techie on 29/01/24

Rampant statistical speculation from before then is entirely unofficial

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

Postby [violet] » Thu Dec 12, 2019 4:22 pm

Flanderlion wrote:These two files

Oh wow, I didn't even realize such a thing existed. Now I understand what some other people were talking about as well!

I'll add it to the doc.
Last edited by [violet] on Thu Dec 12, 2019 4:52 pm, edited 1 time in total.

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

Postby [violet] » Thu Dec 12, 2019 5:26 pm

SherpDaWerp wrote:Can I request a shard that says how much bank a nation has?

Added! Documented under "Deck Owner Info."

User avatar
SherpDaWerp
Technical Moderator
 
Posts: 1895
Founded: Mar 02, 2016
Benevolent Dictatorship

Postby SherpDaWerp » Thu Dec 12, 2019 6:50 pm

[violet] wrote:
SherpDaWerp wrote:Can I request a shard that says how much bank a nation has?

Added! Documented under "Deck Owner Info."

Amazing, thanks heaps!
Became an editor on 18/01/23 techie on 29/01/24

Rampant statistical speculation from before then is entirely unofficial

User avatar
SherpDaWerp
Technical Moderator
 
Posts: 1895
Founded: Mar 02, 2016
Benevolent Dictatorship

Postby SherpDaWerp » Thu Dec 12, 2019 9:43 pm

Gee, I'm way too keen for shiny new features...

Bit of a complicated one, this one. Would it be possible for there to be a way to view the number of unopened card packs a nation has? Not opening them, AFAIK that's been ruled illegal, just checking how many card packs are there.

Given that that information doesn't show up without being logged in, I assume for such a shard there would need to be an authentication process involved, which would make it a bit more annoying than other, publicly-accessible shards.

(If it helps, my end goal here is to have a script that queries all of my puppets and tells me which ones need manual attention - i.e. those with enough bank for me to consider a puppet transfer and those that have lots of unopened card packs. This would mean my "farming" process becomes more streamlined as I can just manually answer issues and then run the script once I'm done, instead of checking cards for every puppet while I'm logged in.)

Thanks again for making this accessible, it's great!
Became an editor on 18/01/23 techie on 29/01/24

Rampant statistical speculation from before then is entirely unofficial

User avatar
Darcania
Envoy
 
Posts: 205
Founded: Dec 29, 2014
Civil Rights Lovefest

Postby Darcania » Fri Dec 13, 2019 7:56 pm

Loving the card API so far, thank you for implementing it and letting devs play around with the beta.
Probably the most major request from me would be to be able to ask for a card by a specified nation name rather than card ID. For instance, rather than querying for "?q=card+info;cardid=1;season=1", I'd like it if there were an option to query via "?q=card+info;cardname=testlandia;season=1" or similar.

Edit: Also, for the Deck Owner Info shard, would it be possible to also receive information on WA Census 86 along with it, namely rankings? And would it be possible to return the deck owner's nation name as well, for when a nation's ID is passed?
Last edited by Darcania on Fri Dec 13, 2019 10:34 pm, edited 1 time in total.

User avatar
Darcania
Envoy
 
Posts: 205
Founded: Dec 29, 2014
Civil Rights Lovefest

Postby Darcania » Tue Dec 17, 2019 10:30 am

Slight bug that Praeceps found: <DECK_SIZE> doesn't take into account whether a nation has PMG, and thus reports inaccurate numbers for PMG nations.
Also, not a bug, but DECK_SIZE is a little misleading... it's the deck's capacity, not its actual size.

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

Postby [violet] » Tue Dec 17, 2019 10:51 pm

SherpDaWerp wrote:Would it be possible for there to be a way to view the number of unopened card packs a nation has?

This is now available as the Private Nation Shard "packs".

As you mention, it requires authentication.

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

Postby [violet] » Tue Dec 17, 2019 11:10 pm

Darcania wrote:Also, for the Deck Owner Info shard, would it be possible to also receive information on WA Census 86 along with it, namely rankings? And would it be possible to return the deck owner's nation name as well, for when a nation's ID is passed?

I've added both of these.

Darcania wrote:Loving the card API so far, thank you for implementing it and letting devs play around with the beta.
Probably the most major request from me would be to be able to ask for a card by a specified nation name rather than card ID. For instance, rather than querying for "?q=card+info;cardid=1;season=1", I'd like it if there were an option to query via "?q=card+info;cardname=testlandia;season=1" or similar.

Unfortunately this isn't possible to add without slowing down the Cards API, since it would require loading a nation.

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

Postby [violet] » Tue Dec 17, 2019 11:11 pm

Darcania wrote:Slight bug that Praeceps found: <DECK_SIZE> doesn't take into account whether a nation has PMG, and thus reports inaccurate numbers for PMG nations.
Also, not a bug, but DECK_SIZE is a little misleading... it's the deck's capacity, not its actual size.

Renamed to DECK_CAPACITY_RAW. Unfortunately it won't report the true deck size since that would require loading a nation to check the account status.

User avatar
SherpDaWerp
Technical Moderator
 
Posts: 1895
Founded: Mar 02, 2016
Benevolent Dictatorship

Postby SherpDaWerp » Tue Dec 17, 2019 11:15 pm

[violet] wrote:
SherpDaWerp wrote:Would it be possible for there to be a way to view the number of unopened card packs a nation has?

This is now available as the Private Nation Shard "packs".

As you mention, it requires authentication.

Praise Violet! Thanks!
Became an editor on 18/01/23 techie on 29/01/24

Rampant statistical speculation from before then is entirely unofficial

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

Postby [violet] » Tue Dec 17, 2019 11:15 pm

PSA: I am planning to remove the <CARDCATEGORY> field from Nation Daily Dump files as well as the undocumented Public Nation Shard, since:
  • it's now available via the Cards API as well as Ballotonia's Trading Cards Daily Dump files
  • it describes an unchanging value
  • it's super inefficient

User avatar
Flanderlion
Minister
 
Posts: 2226
Founded: Nov 25, 2013
Psychotic Dictatorship

Postby Flanderlion » Wed Dec 18, 2019 4:51 am

Darcania wrote:Probably the most major request from me would be to be able to ask for a card by a specified nation name rather than card ID. For instance, rather than querying for "?q=card+info;cardid=1;season=1", I'd like it if there were an option to query via "?q=card+info;cardname=testlandia;season=1" or similar.

Could you not just use: https://www.nationstates.net/cgi-bin/ap ... ion&q=dbid and then use the number in the request? Would take you 2 requests though.
As always, I'm representing myself.
Information
Wishlist

User avatar
Darcania
Envoy
 
Posts: 205
Founded: Dec 29, 2014
Civil Rights Lovefest

Postby Darcania » Wed Dec 18, 2019 6:08 pm

Thank you, [v]

Flanderlion wrote:Could you not just use: https://www.nationstates.net/cgi-bin/ap ... ion&q=dbid and then use the number in the request? Would take you 2 requests though.

That is what I'm currently doing, and I cache and store the results as well. It was simply a feature request to see if a shortcut API-side was possible, which it is not, so I will continue with my current approach.

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

Postby [violet] » Wed Dec 18, 2019 6:56 pm

Starting next update, <DBID> will be included in the Nations Daily Dump, since it's an unchanging value that you might want to fetch for a lot of nations.

User avatar
Darcania
Envoy
 
Posts: 205
Founded: Dec 29, 2014
Civil Rights Lovefest

Postby Darcania » Wed Dec 18, 2019 7:40 pm

Would it be possible to add a DECK_COUNT or some sort for the Deck Owner Info shard, to show how many cards a nation owns without having to load the Decks shard and counting each CARD element? Since some nations have quite a lot of cards, it can slow things down by just a bit to load and count each card.

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

Postby [violet] » Thu Dec 19, 2019 6:11 pm

Darcania wrote:Would it be possible to add a DECK_COUNT or some sort for the Deck Owner Info shard, to show how many cards a nation owns without having to load the Decks shard and counting each CARD element?

Yep! Added as <NUM_CARDS>.

User avatar
The Northern Light
Spokesperson
 
Posts: 156
Founded: Oct 10, 2014
Iron Fist Consumerists

Postby The Northern Light » Sat Jan 04, 2020 2:55 am

Request

In this thread, [violet] mentioned that they'd be open to adding an API option for gifting cards. I wanted to bring this up here as an actual request, and see whether it'd be possible for an option to gift a card to be added to the private nation API.

As discussed in the above-mentioned thread, The North Pacific very actively gifts cards, as part of various promotional and cultural events (examples: 1, 2, 3, 4, 5, 6). We have at least three daily giveaways, plus several one-off events, for a total of more than 2500 high-value gifted cards. Unfortunately, maintaining all of these manually is very tedious, and being able to automated through the API would be very helpful.

Thanks in advance!
Last edited by The Northern Light on Sat Jan 04, 2020 2:55 am, edited 1 time in total.
Home of the WADP, Planet Eras, and the Constibillocode!
Join The North Pacific!
Where the democracy is strong, the debate robust, and the rum plentiful!

Forum | Discord Chat | Citizenship | Executive Staff | North Pacific Army | World Assembly Ministry | Roleplay | Trading Cards | Handbook

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

Postby [violet] » Sat Jan 04, 2020 1:07 pm

The Northern Light wrote:an API option for gifting cards

What would be a reasonable rate, i.e. how many cards per day do you want to gift?

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

Postby [violet] » Sat Jan 04, 2020 6:56 pm

Gifting cards is now supported via API! Documentation is under Nation Private Commands.

User avatar
9003
Diplomat
 
Posts: 624
Founded: Oct 25, 2012
Corporate Police State

Postby 9003 » Mon Jan 06, 2020 12:40 pm

I would love to request a collection management function in the API.

Even if it has to be a slower rate anything that allows it to be automatic would be amazing for people who do large collections for example
Every TNP card or every TWP or every common card
proud member of PETZ people for the Ethical Treatment of Zombies

Active member of The cards market place discord

User avatar
Ferranghia
Lobbyist
 
Posts: 11
Founded: Dec 10, 2015
Corrupt Dictatorship

Postby Ferranghia » Fri Jan 10, 2020 2:27 pm

Greetings.

I would like to write a script that regularly (read, once daily) gets the full census for my nation via the API and on a regular interval (say, the second of every month) posts a templated bulletin in my nation's dispatches highlighting the highest differences since last month, the best performing areas, etc.
Are there any plans of making an endpoint to create dispatches via the API, or do I have to go the HTML script way in order to do that?
Admiral of Ferranghia and master of the puppet government of the_dorvan_protectorate_of_ferranghia
Slowly building the Nationstates API C# Library

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

Postby Agadar » Tue Jan 14, 2020 8:37 am

Ferranghia wrote:Are there any plans of making an endpoint to create dispatches via the API, or do I have to go the HTML script way in order to do that?


The latter is definitely not allowed.
Proud resident of The Western Isles, the #1 role-playing region!
Developer of Telegrammer, NS API Java Wrapper, and more!

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

Postby Trotterdam » Tue Jan 14, 2020 9:40 am

Agadar wrote:The latter is definitely not allowed.
Says where? There is a list of restricted actions that may not be scripted using the HTML site, and creating or editing a dispatch is not among them (since it only affects your own nation and not anything else in the game world).

User avatar
Ferranghia
Lobbyist
 
Posts: 11
Founded: Dec 10, 2015
Corrupt Dictatorship

Postby Ferranghia » Wed Jan 15, 2020 2:59 am

Agadar wrote:
Ferranghia wrote:Are there any plans of making an endpoint to create dispatches via the API, or do I have to go the HTML script way in order to do that?


The latter is definitely not allowed.


How so? The only rule that I think this may be borderlining would be this
anything that generates a Happenings event line in a region, the World Assembly, or a nation other than your own

based on the fact that my nation is in a region that was not founded by me.

Having my bot generate the content for the bullettin and then manually posting it wouldn't be that much of a hassle anyway, it would just be one more inconvenience every month :)
Admiral of Ferranghia and master of the puppet government of the_dorvan_protectorate_of_ferranghia
Slowly building the Nationstates API C# Library

PreviousNext

Advertisement

Remove ads

Return to Technical

Who is online

Users browsing this forum: Apotheosis 222, Artlantic Islands, Erasticanius, The Ancient World, The Kingdom of Rohan, Union of Silver States Union

Advertisement

Remove ads