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
Darcania
Envoy
 
Posts: 205
Founded: Dec 29, 2014
Civil Rights Lovefest

Postby Darcania » Fri Nov 24, 2017 9:15 pm

Just letting you know that Mynamemynamemyname shows up on the members WA shard despite having been ejected sixteen days ago.

User avatar
Minoa
Negotiator
 
Posts: 6074
Founded: Oct 05, 2011
Civil Rights Lovefest

Postby Minoa » Sat Nov 25, 2017 1:35 pm

The State of Minoa is planning to develop a macOS bash script to keep my nations alive (using the ping command) when I am busy, and I wish to enquire if I need an API key, or if it is just for telegrams.
Mme A. d'Oiseau, B.A. (State of Minoa)

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

Postby HMS Unicorn » Sat Nov 25, 2017 10:16 pm

Minoa wrote:The State of Minoa is planning to develop a macOS bash script to keep my nations alive (using the ping command) when I am busy, and I wish to enquire if I need an API key, or if it is just for telegrams.

The API key is only for telegrams. You don't need one for what you describe.

User avatar
Minoa
Negotiator
 
Posts: 6074
Founded: Oct 05, 2011
Civil Rights Lovefest

Postby Minoa » Wed Dec 20, 2017 11:51 pm

We have been running into problems when trying to develop the KeepAlive Bash script: it appears that the X-Password field is mis-reading passwords with special characters, such as !, € or spaces, causing a 403 error. This is despite the fact that it works fine via the browser.

It is bad enough that passwords now need special characters to be reasonably strong.
Last edited by Minoa on Thu Dec 21, 2017 12:00 am, edited 2 times in total.
Mme A. d'Oiseau, B.A. (State of Minoa)

User avatar
Eluvatar
Director of Technology
 
Posts: 3086
Founded: Mar 31, 2006
New York Times Democracy

Postby Eluvatar » Thu Dec 21, 2017 4:41 pm

It's very possible that the character encoding issues are happening at the bash-curl interface layer, not the HTTP layer. I will nonetheless try and experiment with special character using passwords over X-Password to look into whether there's a bug on our end, however.
To Serve and Protect: UDL

Eluvatar - Taijitu member

User avatar
Minoa
Negotiator
 
Posts: 6074
Founded: Oct 05, 2011
Civil Rights Lovefest

Postby Minoa » Fri Dec 22, 2017 1:54 am

Eluvatar wrote:It's very possible that the character encoding issues are happening at the bash-curl interface layer, not the HTTP layer. I will nonetheless try and experiment with special character using passwords over X-Password to look into whether there's a bug on our end, however.

In any case, there should be a way to force Bash or Curl to accept special characters “as-is”.
Mme A. d'Oiseau, B.A. (State of Minoa)

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

Postby Imperium Anglorum » Mon Dec 25, 2017 7:39 am

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).

Want to bump this back up.

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
Auralia
Senator
 
Posts: 4982
Founded: Dec 15, 2011
Ex-Nation

Postby Auralia » Mon Dec 25, 2017 8:29 am

Imperium Anglorum wrote:
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).

Want to bump this back up.

I'd appreciate something like this as well.
Catholic Commonwealth of Auralia
"Amor sequitur cognitionem."

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

Postby Agadar » Mon Dec 25, 2017 7:07 pm

Imperium Anglorum wrote:
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).

Want to bump this back up.


Once again I agree a feature like this would be a great addition.
Proud resident of The Western Isles, the #1 role-playing region!
Developer of Telegrammer, NS API Java Wrapper, and more!

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

Postby Darcania » Thu Dec 28, 2017 1:10 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 would love this.

User avatar
Werreales
Envoy
 
Posts: 279
Founded: Nov 28, 2014
Ex-Nation

Postby Werreales » Tue Jan 02, 2018 4:51 pm

Would it be possible to add an extra parameter dispatchregion for the dispatchlist world shard that queries dispatches of nations pertaining to the same region?

User avatar
Minoa
Negotiator
 
Posts: 6074
Founded: Oct 05, 2011
Civil Rights Lovefest

Postby Minoa » Wed Jan 03, 2018 12:27 pm

Minoa wrote:
Eluvatar wrote:It's very possible that the character encoding issues are happening at the bash-curl interface layer, not the HTTP layer. I will nonetheless try and experiment with special character using passwords over X-Password to look into whether there's a bug on our end, however.

In any case, there should be a way to force Bash or Curl to accept special characters “as-is”.

Follow-up: a decision was made today to use X-autologin instead, thus the (abridged) API call reads:

Code: Select all
curl -H "X-Autologin: (Autologin)" -A "KeepAlive script by Minoa on NationStates (https://www.nationstates.net/nation=minoa) - please contact me at (Email) if the script is malfunctioning" "https://www.nationstates.net/cgi-bin/api.cgi?nation=(nation)&q=ping"

Can anyone confirm any circumstances, other than password change, that will cause X-Autologin to change values?

Edit: Looks like the documentation answers it now.
Last edited by Minoa on Tue Jan 09, 2018 11:08 am, edited 1 time in total.
Mme A. d'Oiseau, B.A. (State of Minoa)

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

Postby Agadar » Wed Jan 24, 2018 3:00 am

Will it ever be possible to create or update dispatches via the API?

EDIT: On a similar note, it does not seem possible to retrieve a dispatch directly via its ID, forcing me to make a work-around for getting a dispatch's contents when I retrieve its ID via regional happenings. Any chance something like that will be added?
Last edited by Agadar on Fri Jan 26, 2018 5:43 pm, edited 2 times in total.
Proud resident of The Western Isles, the #1 role-playing region!
Developer of Telegrammer, NS API Java Wrapper, and more!

User avatar
Caelapes
Ambassador
 
Posts: 1543
Founded: Apr 30, 2007
Ex-Nation

Postby Caelapes » Wed Feb 07, 2018 10:09 pm

I'm getting an XML parse error when getting data for banner "t11":

This page contains the following errors:
error on line 5 at column 21: xmlParseEntityRef: no name


The XML output is:

Code: Select all
<WORLD>
<BANNERS>
<BANNER id="t11">
<NAME>Oversight</NAME>
<VALIDITY></VALIDITY></BANNER></BANNERS></WORLD>
    
The Rose Commune of Caelapes
Ego vero custos fratris mei sum.
aka Misley

User avatar
Eluvatar
Director of Technology
 
Posts: 3086
Founded: Mar 31, 2006
New York Times Democracy

Postby Eluvatar » Wed Feb 07, 2018 10:48 pm

The actual output is:

Code: Select all
<WORLD>
<BANNERS>
<BANNER id="t11">
<NAME>Oversight</NAME>
<VALIDITY>Fund Law & Order in a low-tech nation</VALIDITY>
</BANNER></BANNERS>
</WORLD>


Your XML parser is unhappy because of the unescaped ampersand. There's a couple ways to fix this so I will consult with more a more senior administrator.
To Serve and Protect: UDL

Eluvatar - Taijitu member

User avatar
Caelapes
Ambassador
 
Posts: 1543
Founded: Apr 30, 2007
Ex-Nation

Postby Caelapes » Sun Feb 11, 2018 4:11 pm

Eluvatar wrote:The actual output is:

Code: Select all
<WORLD>
<BANNERS>
<BANNER id="t11">
<NAME>Oversight</NAME>
<VALIDITY>Fund Law & Order in a low-tech nation</VALIDITY>
</BANNER></BANNERS>
</WORLD>


Your XML parser is unhappy because of the unescaped ampersand. There's a couple ways to fix this so I will consult with more a more senior administrator.

Much appreciated.

My attempts to gather a list of extant banners has resulted in a list of 257 banners with the following IDs:
Code: Select all
_0
_1
_2
_3
_4
a1
a2
a3
a4
a5
a6
b1
b2
b3
b4
b5
b6
b7
b8
b9
b10
b11
b12
b13
b14
b15
b16
b17
b18
b19
b20
b21
b22
b23
b24
b25
c1
c2
c3
c4
c5
c6
c7
c8
c9
c10
c11
c12
c13
c14
c15
c16
c17
c18
c19
c20
c21
d1
d2
d3
d4
d5
d6
d7
e1
e2
e3
e4
e5
eg1
f1
f2
f3
f4
f5
g1
g2
g3
h1
h2
i1
i2
i3
i4
i5
i6
i7
i8
i9
i10
i11
i12
i13
i14
i15
i16
i17
i18
i19
i20
i21
i22
i23
i24
i25
i26
k1
k2
k3
k4
l1
l2
l3
l4
l5
l6
l7
l8
l9
l10
l11
l12
l13
l14
l16
l17
l18
l19
l20
l21
l22
l23
l24
l25
l26
l28
l29
l30
l31
l32
l33
l34
l35
l36
l37
l38
l39
l40
l41
l42
l43
l44
l45
m1
m2
m3
m4
m5
m6
m7
m8
n1
n2
n3
n4
n5
o1
o2
o3
o4
o5
o6
o8
o9
o10
p1
p2
p3
p4
p5
p6
p7
p8
p9
p10
p11
p12
p13
p14
p15
p16
p17
p18
p19
p20
p21
p22
p23
p24
p25
p26
q1
r1
r2
r3
r4
r5
r6
r7
r8
r9
r10
r11
s1
s2
s3
t1
t2
t4
t5
t6
t8
t9
t10
t11
t12
t13
t14
t15
t16
t17
t18
t19
t20
t21
t22
t23
t24
t25
t26
t27
tv1
u1
u2
v1
w1
w2
w3
wa1
x1
x2
x3
x4
x5
x6
z1
z2

Assuming it's not a secret, is this all of them or am I missing some?

Also - I had some issues with issue 721:
Code: Select all
<ISSUE id="721">
            <TITLE>A Lack of Comma Sense</TITLE>
            <TEXT>After your highest-ranking legislative aide dedicated her new memoir to ‘my parents, Leader and Maxx’, unreputable news sources, &lt;i&gt;the Whale Gazette&lt;/i&gt; and &lt;i&gt;the Tchaikovsky Times&lt;/i&gt; have been harassing your office incessantly about nepotism in your administration. An assortment of advisers have met with you over some bamboo soup to discuss this serial issue.</TEXT>
            <AUTHOR>a_humanist_science</AUTHOR>
            <EDITOR>luna_amore</EDITOR>
            <PIC1>z9</PIC1>
            <PIC2>tv5</PIC2>
            <OPTION id="0">“The serial comma avoids ambiguous meanings,” says ghostwriter Willie Gorbachev, while picking the bay leaves from among the shoots. “Had there been a comma after ‘Leader’ but before ‘and,’ the intended meaning of the sentence would have been obvious. Hopefully, you can see why our government needs to create and maintain a mandatory style guide. The point being is that this initiative should be funded right away! After all, it’s best to write safe.”</OPTION>
            <OPTION id="1">“The serial comma can just as easily add ambiguous meaning, and just takes up space unnecessarily,” replies photographer Carter Morris as he tries to shoot the leaves before he eats. “Don’t you find its usage to be not correct? And are you ready to convince the taxpayer of the extra expense they will be taking on? Because that’s what you will have to do.”</OPTION>
            <OPTION id="2">Your Pear Phone suddenly starts vibrating as you receive the following text: &lt;i&gt;imho we dont ned ne govt stile gide or grmmer or cursvie... mind ur own busnss... we type how we type... mabe the govt shud lern our way... idk idc whatevs ttyl&lt;/i&gt;</OPTION>
            <OPTION id="3">“Punctuation is but a way for the elites to once again restrain the exchange of free ideas,” begins noted windba— “in order to further hold down oppress and smother and stamp out the honest working men and women of this country into a state of utter and complete impotence,” he continues, “so that the entitled and ruthless would be leaders of this world could sit in their castles built on the backs and labor of the commoner,” he continues further, “and smugly judge and spit on them in distain but to that I say no we shall not take on your shackles and chains of punctuation as we will not be bullied into constrained or controlled or ignoble speech...” showing no sign of stopping, he is gently nudged out the door by your guards and — surprising no one — continues as he leaves.</OPTION>
        </ISSUE>

in particular, option 3. Any idea what went wrong there? And is <i> (and presumably <b> or <u>) the only HTML that we can expect to encounter in issue text? I'm trying to anticipate these so I can convert it to Markdown formatting.
Last edited by Caelapes on Sun Feb 11, 2018 4:38 pm, edited 1 time in total.
    
The Rose Commune of Caelapes
Ego vero custos fratris mei sum.
aka Misley

User avatar
Eluvatar
Director of Technology
 
Posts: 3086
Founded: Mar 31, 2006
New York Times Democracy

Postby Eluvatar » Sun Feb 11, 2018 5:17 pm

What's the problem with option 3, exactly?
To Serve and Protect: UDL

Eluvatar - Taijitu member

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

Postby Trotterdam » Sun Feb 11, 2018 5:45 pm

Caelapes wrote:My attempts to gather a list of extant banners has resulted in a list of 257 banners with the following IDs:
Code: Select all
_0
_1
_2
_3
_4
a1
a2
a3
a4
a5
a6
b1
b2
b3
b4
b5
b6
b7
b8
b9
b10
b11
b12
b13
b14
b15
b16
b17
b18
b19
b20
b21
b22
b23
b24
b25
c1
c2
c3
c4
c5
c6
c7
c8
c9
c10
c11
c12
c13
c14
c15
c16
c17
c18
c19
c20
c21
d1
d2
d3
d4
d5
d6
d7
e1
e2
e3
e4
e5
eg1
f1
f2
f3
f4
f5
g1
g2
g3
h1
h2
i1
i2
i3
i4
i5
i6
i7
i8
i9
i10
i11
i12
i13
i14
i15
i16
i17
i18
i19
i20
i21
i22
i23
i24
i25
i26
k1
k2
k3
k4
l1
l2
l3
l4
l5
l6
l7
l8
l9
l10
l11
l12
l13
l14
l16
l17
l18
l19
l20
l21
l22
l23
l24
l25
l26
l28
l29
l30
l31
l32
l33
l34
l35
l36
l37
l38
l39
l40
l41
l42
l43
l44
l45
m1
m2
m3
m4
m5
m6
m7
m8
n1
n2
n3
n4
n5
o1
o2
o3
o4
o5
o6
o8
o9
o10
p1
p2
p3
p4
p5
p6
p7
p8
p9
p10
p11
p12
p13
p14
p15
p16
p17
p18
p19
p20
p21
p22
p23
p24
p25
p26
q1
r1
r2
r3
r4
r5
r6
r7
r8
r9
r10
r11
s1
s2
s3
t1
t2
t4
t5
t6
t8
t9
t10
t11
t12
t13
t14
t15
t16
t17
t18
t19
t20
t21
t22
t23
t24
t25
t26
t27
tv1
u1
u2
v1
w1
w2
w3
wa1
x1
x2
x3
x4
x5
x6
z1
z2

Assuming it's not a secret, is this all of them or am I missing some?
You are missing eg2. I believe that's it.

Caelapes wrote:in particular, option 3.
I'm pretty sure those are supposed to be em dashes. It's probably confusion over whether the text is in Unicode (em dash is U+2014, UTF-8 encoding E2 80 94) or Windows-1252 (codepoint 97), the latter of which is an unofficial extension to ISO-8859-1 (which is often considered the "default" character encoding by computers) that was more or less made official because everyone kept using it anyway.

This could all be avoided by using HTML character entities, but then your script would have to recognize them.

Caelapes wrote:Any idea what went wrong there? And is <i> (and presumably <b> or <u>) the only HTML that we can expect to encounter in issue text? I'm trying to anticipate these so I can convert it to Markdown formatting.
There's at least <sup> and <sub>, too.
Last edited by Trotterdam on Sun Feb 11, 2018 7:15 pm, edited 1 time in total.

User avatar
Walrusvylon
Diplomat
 
Posts: 796
Founded: Nov 04, 2016
Ex-Nation

Postby Walrusvylon » Mon Feb 12, 2018 10:05 am

Is there a way I could access the trends data for my nation in a way that I could then plot the data with matplotlib in Python?
Last edited by Walrusvylon on Mon Feb 12, 2018 10:12 am, edited 1 time in total.
Reactionary rad-trad. Born between 6 and 11 centuries too late. Neocameralist some days, un-constitutional monarchist and neo-Luddite other days. Tolkien enthusiast. Neoreaction/Dark Enlightenment reader.
'Equality is the opposite of quality.'
'I strongly urge you to read Moldbug!'
'I am an excellent proof-reader... after I click submit.'

User avatar
Eluvatar
Director of Technology
 
Posts: 3086
Founded: Mar 31, 2006
New York Times Democracy

Postby Eluvatar » Mon Feb 12, 2018 12:31 pm

Walrusvylon wrote:Is there a way I could access the trends data for my nation in a way that I could then plot the data with matplotlib in Python?

Yes though you'd have to convert that to something matplotlib will understand.
To Serve and Protect: UDL

Eluvatar - Taijitu member

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

Postby Imperium Anglorum » Tue Feb 13, 2018 3:35 pm

Agadar wrote:Will it ever be possible to create or update dispatches via the API?

EDIT: On a similar note, it does not seem possible to retrieve a dispatch directly via its ID, forcing me to make a work-around for getting a dispatch's contents when I retrieve its ID via regional happenings. Any chance something like that will be added?

^ This.

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
The Qadaan
Lobbyist
 
Posts: 17
Founded: Jan 29, 2018
Ex-Nation

Postby The Qadaan » Tue Feb 13, 2018 4:19 pm

how would i make the news broadcast box at the bottom of my posts???

User avatar
Leppikania
Minister
 
Posts: 2332
Founded: Apr 13, 2015
Left-wing Utopia

Postby Leppikania » Thu Feb 15, 2018 7:59 pm

When my script tells me that an address is unavailable, is that a problem with my script or with the server? In other words, should I report it when it happens?
INTP, -4.25 Economic Left/Right, -4.1 Social Libertarian/Authoritarian, tastes like chicken.
I do use NS stats, thank you very much.
Funny Quotes
Pie charts for industries
Request an Embassy

User avatar
Eluvatar
Director of Technology
 
Posts: 3086
Founded: Mar 31, 2006
New York Times Democracy

Postby Eluvatar » Thu Feb 15, 2018 8:11 pm

More details would help answer this question.
To Serve and Protect: UDL

Eluvatar - Taijitu member

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

Postby Trotterdam » Fri Feb 16, 2018 3:01 am

If the exact same URL request sometimes works and sometimes doesn't, then the problem is probably with the server, or maybe your internet connection, rather than your script (unless you're a really sloppy programmer). Though server errors of the "wait a minute and try again" variety are probably not worth reporting. That kind of stuff just happens.

If the script has never worked, or certain types of uses for the script consistently fail to work while other uses do work, then you're probably doing something wrong.

PreviousNext

Advertisement

Remove ads

Return to Technical

Who is online

Users browsing this forum: America the Greater, Concordare, Flegetonte, Giovanniland, Grishahakkaverchynot, Khantin, La Xinga, Marxist Land of Peoples, Montandi-Cisalpina, Riemstagrad, Santiago AU, Velonea

Advertisement

Remove ads