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
Envoy
 
Posts: 326
Founded: Mar 02, 2016
Anarchy

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.
OOC: High school student who should almost definitely be doing assignments instead
  • I once wrote a 924-word analysis of how memes-as-political-commentary have a detrimental impact on many social issues. I got a 90% grade on my first draft.
  • My hobbies/interests include programming, parkour, hiking, camping, gaming, tabletop RPGs, and playing NationStates, of course
  • I seem to spend quite a bit of time explaining the effects of issue options. Good reading comprehension and a basic understanding of NS stats can work wonders, even without a backstage pass...

User avatar
[violet]
Site Admin
 
Posts: 14456
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]
Site Admin
 
Posts: 14456
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
Envoy
 
Posts: 326
Founded: Mar 02, 2016
Anarchy

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!
OOC: High school student who should almost definitely be doing assignments instead
  • I once wrote a 924-word analysis of how memes-as-political-commentary have a detrimental impact on many social issues. I got a 90% grade on my first draft.
  • My hobbies/interests include programming, parkour, hiking, camping, gaming, tabletop RPGs, and playing NationStates, of course
  • I seem to spend quite a bit of time explaining the effects of issue options. Good reading comprehension and a basic understanding of NS stats can work wonders, even without a backstage pass...

User avatar
SherpDaWerp
Envoy
 
Posts: 326
Founded: Mar 02, 2016
Anarchy

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!
OOC: High school student who should almost definitely be doing assignments instead
  • I once wrote a 924-word analysis of how memes-as-political-commentary have a detrimental impact on many social issues. I got a 90% grade on my first draft.
  • My hobbies/interests include programming, parkour, hiking, camping, gaming, tabletop RPGs, and playing NationStates, of course
  • I seem to spend quite a bit of time explaining the effects of issue options. Good reading comprehension and a basic understanding of NS stats can work wonders, even without a backstage pass...

User avatar
Darcania
Spokesperson
 
Posts: 148
Founded: Dec 29, 2014
Left-wing Utopia

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
Spokesperson
 
Posts: 148
Founded: Dec 29, 2014
Left-wing Utopia

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]
Site Admin
 
Posts: 14456
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]
Site Admin
 
Posts: 14456
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]
Site Admin
 
Posts: 14456
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
Envoy
 
Posts: 326
Founded: Mar 02, 2016
Anarchy

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!
OOC: High school student who should almost definitely be doing assignments instead
  • I once wrote a 924-word analysis of how memes-as-political-commentary have a detrimental impact on many social issues. I got a 90% grade on my first draft.
  • My hobbies/interests include programming, parkour, hiking, camping, gaming, tabletop RPGs, and playing NationStates, of course
  • I seem to spend quite a bit of time explaining the effects of issue options. Good reading comprehension and a basic understanding of NS stats can work wonders, even without a backstage pass...

User avatar
[violet]
Site Admin
 
Posts: 14456
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
Ambassador
 
Posts: 1522
Founded: Nov 25, 2013
Iron Fist Consumerists

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 as a citizen, rather than as part of the Government, if I am at the time.

User avatar
Darcania
Spokesperson
 
Posts: 148
Founded: Dec 29, 2014
Left-wing Utopia

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]
Site Admin
 
Posts: 14456
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
Spokesperson
 
Posts: 148
Founded: Dec 29, 2014
Left-wing Utopia

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]
Site Admin
 
Posts: 14456
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
Attaché
 
Posts: 96
Founded: Oct 10, 2014
Inoffensive Centrist Democracy

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]
Site Admin
 
Posts: 14456
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]
Site Admin
 
Posts: 14456
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
Envoy
 
Posts: 288
Founded: Oct 25, 2012
Iron Fist Consumerists

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
Civil Servant
 
Posts: 7
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: 7768
Founded: Dec 06, 2009
Father Knows Best State

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
Powerbroker
 
Posts: 8204
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
Civil Servant
 
Posts: 7
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: Chap Ven

Advertisement

Remove ads