Page 74 of 97

PostPosted: Tue Apr 10, 2018 7:55 pm
by Leppikania
Eluvatar wrote:An alternative would be to require an API key. The intent, either way, would be to better avoid abuse.

I just don't think it would make sense as a private shard. Another option, I think, would be to have a stricter rate limit.

PostPosted: Fri Apr 13, 2018 7:17 am
by HMS Unicorn
Eluvatar wrote:What censuses do you refer to as having been selectively included?

Don't the various stats included in the nation dump correspond to various censuses?

PostPosted: Tue Apr 17, 2018 11:09 pm
by Imperium Anglorum
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).

Bump.

PostPosted: Fri May 11, 2018 12:08 am
by Roavin
For synchronization purposes, it'd be really useful if there was a server time shard.

That is, this request:
Code: Select all
https://www.nationstates.net/cgi-bin/api.cgi?q=time


Returns this:
Code: Select all
<WORLD><TIME>1526022475</TIME></WORLD>

PostPosted: Fri May 11, 2018 10:00 am
by Darcania
Roavin wrote:For synchronization purposes, it'd be really useful if there was a server time shard.

HTTP requests return a "DATE" header field with the server's current time. That should be useful for your purposes. It's a string in the format of "Fri, 11 May 2018 16:59:03 GMT" so you'll have to parse it a bit.

PostPosted: Fri May 11, 2018 1:14 pm
by Eluvatar
Darcania is correct, and Roavin should actually have access to examples of my code that use that, such as:
Code: Select all
    timestamp = timegm(xml.headers.getdate("Date"))

(Where the variable xml is the result from a call to api.request from trawler-parser-python)
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).

Bump.

Yes that's a good idea, but it's lower in my priorities than, say, improving update speed right now. Sorry.

PostPosted: Fri May 11, 2018 4:33 pm
by Roavin
Eluvatar wrote:Darcania is correct, and Roavin should actually have access to examples of my code that use that, such as:
Code: Select all
    timestamp = timegm(xml.headers.getdate("Date"))

(Where the variable xml is the result from a call to api.request from trawler-parser-python)


Oh, welp, somehow I missed that. Thanks, Darc and Elu!

PostPosted: Sun May 20, 2018 5:22 am
by Agadar
It would be awesome if it were possible to send telegrams without requiring a telegram id with a secret key, instead simply supplying a body. That would, for example, allow a new application I'm developing for assisting me in my TWI Info Office duties to send me a notification telegram whenever new updates are available for publishing.

possible bug (?)

PostPosted: Sun May 20, 2018 8:53 am
by Honk Donk
for the nation verification api, the api currently returns
"0\n"
or
"1\n"
. However the documentation says it should return
"0"
or
"1"
(no newline). Is this a bug or is it intended? If it's intended, would it be possible to update the documentation?

(it just confused me a bit because it didn't equal 1 or 0 when I was using it)

PostPosted: Sun May 20, 2018 3:48 pm
by Agadar
On another note, it does not seem possible to retrieve the number of RMB pages from the API, nor to derive it from other data. Instead, I will have to resort to scraping the webpage itself, which is messy. Is it possible to have this number made available from the API?

PostPosted: Sun May 20, 2018 8:57 pm
by Eluvatar
Agadar wrote:It would be awesome if it were possible to send telegrams without requiring a telegram id with a secret key, instead simply supplying a body. That would, for example, allow a new application I'm developing for assisting me in my TWI Info Office duties to send me a notification telegram whenever new updates are available for publishing.

Not allowing scripts to send arbitrary text is a design feature, not a bug. And no script should create any telegram template.

It may be possible to work around this by sending a telegram which links to a dispatch which is separately updated.

Honk Donk wrote:for the nation verification api, the api currently returns
"0\n"
or
"1\n"
. However the documentation says it should return
"0"
or
"1"
(no newline). Is this a bug or is it intended? If it's intended, would it be possible to update the documentation?

(it just confused me a bit because it didn't equal 1 or 0 when I was using it)


I don't intend to change this.

PostPosted: Sun May 20, 2018 11:20 pm
by Imperium Anglorum
Eluvatar wrote:I don't intend to change this.

But why? Why keep it when it is including a new line, especially when the documentation says it doesn't do that?

PostPosted: Mon May 21, 2018 4:18 am
by Agadar
Eluvatar wrote:
Agadar wrote:It would be awesome if it were possible to send telegrams without requiring a telegram id with a secret key, instead simply supplying a body. That would, for example, allow a new application I'm developing for assisting me in my TWI Info Office duties to send me a notification telegram whenever new updates are available for publishing.

Not allowing scripts to send arbitrary text is a design feature, not a bug. And no script should create any telegram template.

It may be possible to work around this by sending a telegram which links to a dispatch which is separately updated.


That would not be very useful for my use case, as it's not possible (nor allowed) to update dispatches via scripts, which is what your proposed solution would entail.

I suppose I'll have to resort to my script e-mailing me or something when it has updates ready for me.

PostPosted: Sun May 27, 2018 6:45 am
by Honk Donk
Eluvatar wrote:I don't intend to change this.

Why not? I understand why you wouldn't change the api itself but surely you can modify the documentation to include a note about the newline?

PostPosted: Sun May 27, 2018 6:00 pm
by Eluvatar
I meant that I don't intend to change the behavior.

I may make a change to the documentation.

PostPosted: Sat Jul 14, 2018 6:04 pm
by Glen-Rhodes
Would it be possible to include a "natives" shard in the region API, listing which nations count as "natives" for poll purposes?

PostPosted: Mon Jul 23, 2018 3:43 am
by Honk Donk
If you don't specify any shard names (for nation, region, etc), what is the default list that is used? The docs just say "a compendium of the most commonly sought information" - what does this mean exactly?

Edit: after some time manually working this out, I have calculated that for nations, the default shard list is
Code: Select all
name+type+fullname+motto+category+wa+endorsements+freedom+region+population+tax+animal+currency+demonym+demonym2+demonym2plural+flag+majorindustry+govtpriority+govt+founded+firstlogin+lastlogin+lastactivity+influence+freedomscores+publicsector+deaths+leader+capital+religion+cardcategory
, or everything except for
Code: Select all
govtdesc, richest, legislation, tgcanrecruit, census, notable, banners, industrydesc, banner, wcensus, happenings, dbid, policies, dispatchlist, animaltrait, factbooklist, customcapital, admirable, sectors, customleader, tgcancampaign, crime, poorest, scvote, zombie, gavote, sensibilities, customreligion, gdp, rcensus, wabadges, factbooks, foundedtime, income, dispatches


Would it be possible for this info to be put into the API docs, as well as the corresponding info for regions, etc?

PostPosted: Mon Jul 23, 2018 6:18 am
by Trotterdam
I would really recommend against using a "default list", unless you're just quickly testing something rather than making a real application. I always tune my API requests to ask exactly the information I'm interested in and going to use (or at least information that I'm maybe going to use depending on what other information from the same request looks like), nothing more or less.

PostPosted: Mon Jul 23, 2018 8:19 am
by Honk Donk
Trotterdam wrote:I would really recommend against using a "default list", unless you're just quickly testing something rather than making a real application. I always tune my API requests to ask exactly the information I'm interested in and going to use (or at least information that I'm maybe going to use depending on what other information from the same request looks like), nothing more or less.

True, but for what I'm doing (API wrapper library) I do need to know this.

PostPosted: Wed Jul 25, 2018 6:39 am
by Zone 71
I currently have a Client Key for the purposes of recruitment in my region, The Quarantine. Would I need to request a different Client Key if I were to instead use my API to promote World Assembly legislation?

PostPosted: Wed Jul 25, 2018 9:01 am
by Frisbeeteria
Zone 71 wrote:I currently have a Client Key for the purposes of recruitment in my region, The Quarantine. Would I need to request a different Client Key if I were to instead use my API to promote World Assembly legislation?

The same key works for all API purposes, so no, you don't need another one. All keys are currently issued as recruitment keys, and consequently all regional recruitment telegrams related to that key are permanently tied to the original region. Campaign and/or other telegrams don't include a regional recruitment link, so you're fine. Don't forget to tick the appropriate checkbox when creating your TG template.

PostPosted: Wed Jul 25, 2018 9:08 am
by Zone 71
Frisbeeteria wrote:
Zone 71 wrote:I currently have a Client Key for the purposes of recruitment in my region, The Quarantine. Would I need to request a different Client Key if I were to instead use my API to promote World Assembly legislation?

The same key works for all API purposes, so no, you don't need another one. All keys are currently issued as recruitment keys, and consequently all regional recruitment telegrams related to that key are permanently tied to the original region. Campaign and/or other telegrams don't include a regional recruitment link, so you're fine. Don't forget to tick the appropriate checkbox when creating your TG template.

Awesome. Thank you.

PostPosted: Wed Jul 25, 2018 10:52 am
by Vungar
Can somebody get me a very detailed step by step guide on this? I am not very good with this kind of stuff.

PostPosted: Tue Aug 21, 2018 9:16 am
by August
Got a couple requests for new shards.

1. Site staff. This would be a Nation API shard, something like this: <STAFF>Moderator</STAFF>. Other options would be Administrator and Issues Editor. (More options like Forum Moderator, Game Moderator, Tech Modling, Issues Tech, etc, would be nice, but not as important.) Non-staff nations would just have an empty tag: <STAFF></STAFF>.
2. More modes for the census shard on the Nation and Region APIs. At the moment, nation=august;q=census;scale=0+1+2;mode=score+rank gets my scores and ranks for Civil Rights, Economy, and Political Freedom. Now, I can use the World API to grab the description, title, name, and units for those census categories (using a separate API call for each, because they cannot be combined), but that adds up quickly. It would be very helpful to have ;mode=name+title+units+desc or something to that effect.

Thank you for considering.

PostPosted: Fri Aug 24, 2018 8:30 am
by Eluvatar
Why do you want (1)?

Can't you cache the description, title, name, and units once fetched? What do you wish to do for which having the API fill them in for you would help?

(Not saying these requests definitely won't be implemented, just trying to get some context for them.)