NATION

PASSWORD

NationStates API (nationdata/regiondata)

Bug reports, general help, ideas for improvements, and questions about how things are meant to work.

Remove ads

User avatar
Poopsadon
Civil Servant
 
Posts: 9
Founded: Jul 10, 2012
Anarchy

Postby Poopsadon » Sat Mar 11, 2017 2:43 pm

Does anyone know if there is a recommended way to make calls to answer issues. At the moment my understanding is the the API lets you access data but not modify anything but if I'm mistaken I'd be curious to know how.

My hope was to make a simple script to comb through a series of my puppets and randomly determine their daily fate :P

User avatar
Trotterdam
Minister
 
Posts: 3055
Founded: Jan 12, 2012
Inoffensive Centrist Democracy

Postby Trotterdam » Sat Mar 11, 2017 4:58 pm

I don't think there is currently an API call for that. A private API shard is expected at some point in the indefinite future, but currently even the private API shards are all read-only.

Unless [violet] is willing to take the time to add that, your best option is to write a non-API script that uses the same issue-answering URL human players do. Note that non-API scripts have different rules from API-using scripts, the most important one of which (for your application) is that the ratelimit is 10 per minute instead of 100 per minute.

Note that you can make things a little easier on both your script and the server by appending /template-overall=none to the URL, for example http://www.nationstates.net/page=dilemmas/template-overall=none. I'm not sure where I learned that, the linked script rules seem to make no mention of it.

Or more topically, http://www.nationstates.net/page=enact_dilemma/dilemma=X/choice-Y=1/template-overall=none (don't click on that!), where X is the number of the issue, and Y is the internal number of the option (usually one less than the displayed number, so 0 for the first option, 1 for the second option, etc., but can be different if some options don't appear due to option validities, and -1 for dismissal).

User avatar
Poopsadon
Civil Servant
 
Posts: 9
Founded: Jul 10, 2012
Anarchy

Postby Poopsadon » Sun Mar 12, 2017 12:36 am

Trotterdam wrote:I don't think there is currently an API call for that. A private API shard is expected at some point in the indefinite future, but currently even the private API shards are all read-only.

Unless [violet] is willing to take the time to add that, your best option is to write a non-API script that uses the same issue-answering URL human players do. Note that non-API scripts have different rules from API-using scripts, the most important one of which (for your application) is that the ratelimit is 10 per minute instead of 100 per minute.

Note that you can make things a little easier on both your script and the server by appending /template-overall=none to the URL, for example http://www.nationstates.net/page=dilemmas/template-overall=none. I'm not sure where I learned that, the linked script rules seem to make no mention of it.

Or more topically, http://www.nationstates.net/page=enact_dilemma/dilemma=X/choice-Y=1/template-overall=none (don't click on that!), where X is the number of the issue, and Y is the internal number of the option (usually one less than the displayed number, so 0 for the first option, 1 for the second option, etc., but can be different if some options don't appear due to option validities, and -1 for dismissal).


This is tremendously helpful; thank you! I was unaware of the template-overall=none trick but it definitely makes it easier to pick out the info I need.

User avatar
Imperium Anglorum
Negotiator
 
Posts: 5872
Founded: Aug 26, 2013
Civil Rights Lovefest

Postby Imperium Anglorum » Mon Mar 13, 2017 5:17 am

A bug report. Currently, when calling this query:

Code: Select all
https://www.nationstates.net/cgi-bin/api.cgi?wa=1&id=257&q=resolution

For the /WA/RESOLUTION/OPTION/text() field, I get 0 instead of the actual Area of Effect/Strength, Automobile Manufacturing.

This is the same with most other categories as well. For Mild resolutions, it shows 0 instead of Mild.
Last edited by Imperium Anglorum on Wed Mar 15, 2017 12:43 am, edited 1 time in total.
Delegate of Europe
His Grace, Cyril Parsons, The Duke of Geneva and Proconsul XIV
Ideological Bulwark 285

User avatar
Imperium Anglorum
Negotiator
 
Posts: 5872
Founded: Aug 26, 2013
Civil Rights Lovefest

Postby Imperium Anglorum » Fri Mar 17, 2017 8:19 am

Also, would it be possible to have an API query which tells us what kind of telegram is being sent? Something like:

Code: Select all
https://www.nationstates.net/cgi-bin/api.cgi?a=infoTG&tgid=(TGID)&key=(Secret Key)

Returning information on the telegram itself, like the delivery data, by whom the telegram was blocked, and what kind of telegram is being sent (recruitment, campaign, unmarked).
Delegate of Europe
His Grace, Cyril Parsons, The Duke of Geneva and Proconsul XIV
Ideological Bulwark 285

User avatar
HMS Unicorn
Spokesperson
 
Posts: 159
Founded: Jun 29, 2005
Inoffensive Centrist Democracy

Postby HMS Unicorn » Mon Mar 20, 2017 3:57 pm

Imperium Anglorum wrote:Also, would it be possible to have an API query which tells us what kind of telegram is being sent? Something like:

Code: Select all
https://www.nationstates.net/cgi-bin/api.cgi?a=infoTG&tgid=(TGID)&key=(Secret Key)

Returning information on the telegram itself, like the delivery data, by whom the telegram was blocked, and what kind of telegram is being sent (recruitment, campaign, unmarked).

This would be tremendously useful.

User avatar
Agadar
Powerbroker
 
Posts: 7598
Founded: Dec 06, 2009
Civil Rights Lovefest

Postby Agadar » Mon Mar 20, 2017 4:11 pm

Imperium Anglorum wrote:Also, would it be possible to have an API query which tells us what kind of telegram is being sent? Something like:

Code: Select all
https://www.nationstates.net/cgi-bin/api.cgi?a=infoTG&tgid=(TGID)&key=(Secret Key)

Returning information on the telegram itself, like the delivery data, by whom the telegram was blocked, and what kind of telegram is being sent (recruitment, campaign, unmarked).

I'd be glad with something as simple as an API call that requires a telegram id and returns the type of the corresponding telegram template (recruitment/campaign/unmarked). With something like that, us auto-telegrammer developers wouldn't have to rely any more on the users -possibly incorrectly- supplying the telegram type (which we need to know for the rate limits).

Never mind the above, I misread your feature request. I thought you meant for the telegram API to return that data, but you mean for an entirely new API call to do so. I would like something like that as well.
Last edited by Agadar on Mon Mar 20, 2017 4:13 pm, edited 1 time in total.
Information Secretary of The Western Isles, the #1 role-playing region!
Developer of Telegrammer, NS API Java Wrapper, and more!

User avatar
Imperium Anglorum
Negotiator
 
Posts: 5872
Founded: Aug 26, 2013
Civil Rights Lovefest

Postby Imperium Anglorum » Mon Mar 20, 2017 6:42 pm

Agadar wrote:With something like that, us auto-telegrammer developers wouldn't have to rely any more on the users -possibly incorrectly- supplying the telegram type (which we need to know for the rate limits).

I too trust my code more than the users. :P
Delegate of Europe
His Grace, Cyril Parsons, The Duke of Geneva and Proconsul XIV
Ideological Bulwark 285

User avatar
Panther Ausf G
Civilian
 
Posts: 1
Founded: Feb 11, 2016
Capitalist Paradise

Postby Panther Ausf G » Fri Mar 31, 2017 7:07 pm

Granted, this is likely a one-off thing, but is there a chance that we can get some API shards for the nuclear war, if possible?

User avatar
[violet]
Site Admin
 
Posts: 12412
Founded: Antiquity

Postby [violet] » Fri Mar 31, 2017 10:06 pm

Unfortunately it's not feasible to create API support for one-off events.

User avatar
TKS 20mm
Civilian
 
Posts: 1
Founded: Feb 12, 2016
Father Knows Best State

Postby TKS 20mm » Sat Apr 01, 2017 1:35 am

Figured as much, but might as well ask anyway!
Thanks for the response ^^

Previous

Remove ads

Return to Technical

Who is online

Users browsing this forum: [violet], Abhichandra, Caelapes, Drop Your Pants, Iansisle, Kingdom of Ferelden, New Ducklands, One World States, Socio Polor

Remove ads