Caelapes wrote:reset the CTE-by-inactivity timer?
I too would like to know this.
Advertisement
by Imperium Anglorum » Thu Aug 11, 2016 1:09 pm
Caelapes wrote:reset the CTE-by-inactivity timer?
by Trotterdam » Thu Aug 11, 2016 2:32 pm
by [violet] » Thu Aug 11, 2016 4:14 pm
Flanderlion wrote:using this to view the data, then using the nation pages to actually execute the operations wouldn't be more efficient timewise for me yet, despite the higher rate limits for API.
Flanderlion wrote:Also for just clicking the link (in browser) from my logged in nation, would it be able to appear authenticated so you can view what you'd get for yourself.
Caelapes wrote:Does accessing a private shard reset the CTE-by-inactivity timer?
Trotterdam wrote:What's the time limit for non-PIN logins? Currently it just says "within a few seconds".
by Flanderlion » Fri Aug 12, 2016 1:12 am
[violet] wrote:Flanderlion wrote:using this to view the data, then using the nation pages to actually execute the operations wouldn't be more efficient timewise for me yet, despite the higher rate limits for API.
The next step after filling out the private shards will be to add an API that lets you make changes to nations, like answering issues, rather than just gathering information about them. Long-term, I aim to migrate all script/bot activity to the API, which would provide several advantages for us and legal scripters.Flanderlion wrote:Also for just clicking the link (in browser) from my logged in nation, would it be able to appear authenticated so you can view what you'd get for yourself.
Unfortunately no, as this would make the API vulnerable to XSS attacks using your cookies. You need to use headers.Caelapes wrote:Does accessing a private shard reset the CTE-by-inactivity timer?
Yes.
by Caelapes » Sat Aug 13, 2016 8:14 am
by The United Island Tribes » Sun Aug 14, 2016 10:23 am
by [violet] » Sun Aug 14, 2016 3:44 pm
The United Island Tribes wrote:The documentation implies that Pins should not get conflict errors
by [violet] » Sun Aug 14, 2016 3:50 pm
Caelapes wrote:I assume [...] there is a recommendation against sharing PINs and especially autologins for the purposes of allowing other users to run puppet-maintaining scripts?
by Nationstates API Test Nation » Mon Aug 15, 2016 6:27 am
[violet] wrote:The United Island Tribes wrote:The documentation implies that Pins should not get conflict errors
This is correct: You can't get a 409 Conflict error from a valid Pin. You can, however, get a 409 if you send an expired Pin along with a Password or Autologin header, since that will fallback to a new login attempt, as per the flowchart diagram in the API doc.
by Atagait Denral » Fri Aug 19, 2016 12:28 pm
by HMS Unicorn » Fri Aug 19, 2016 2:41 pm
[violet] wrote:I've added "Private Shards," for when you want to access information that's only available to a logged-in nation.
For now the only shard is "unread", which will tell you how many new TGs, Issues, etc, you have. But I aim to expand it in the future to cover telegrams, issues, and more. So please give this a test and let me know what you think.
For details see "Private Shards" in the API doc!
by HMS Unicorn » Fri Aug 19, 2016 2:48 pm
HMS Unicorn wrote:Bug report
I came across this nation: the_will_of_christ. Even though the nation is present in region Europeia, it is not listed in the following API call:
http://www.nationstates.net/cgi-bin/api.cgi?region=europeia&q=nations
It is also not mentioned in either the region or nation dumps.
On the other hand, it does seem to be present in the nation API, e.g.,
http://www.nationstates.net/cgi-bin/api.cgi?nation=the_will_of_christ&q=region
The nation moved from The West Pacific to Europeia during the major update of July 20th. It moved into Europeia after it had finished updating, and it moved out of The West Pacific while it was updating. I do not know whether the nation itself had updated in TWP by the time it moved.
The fact that it seemingly missed an update may be the cause of the bug, though it has been quite a while since then.
by Atagait Denral » Fri Aug 19, 2016 2:59 pm
by Eluvatar » Fri Aug 19, 2016 8:53 pm
HMS Unicorn wrote:3) Creating new telegram templates or API templates for that nation (obviously *not* sending them, unless it is through the telegram API).
by HMS Unicorn » Fri Aug 19, 2016 11:50 pm
Eluvatar wrote:That is, at least currently, against the rules, within or without the API.
The reason, basically, is to make sure scripters can't make individualized messages the way manual message-senders can (i.e. remarks about the nation's motto or the like). It is not legal to create templates without user action. I realize that the use-case you have in mind is for clerical changes to telegrams that would still be sent to many nations without 'customization', but the technical rule has been written to have a clear, technical, line.
by HMS Unicorn » Mon Aug 22, 2016 6:19 am
Maplou wrote:Is there anyone who has an example of private shards with curl for php or any other method to get it over the web?
curl -A "YOUR_USER_AGENT" -H "Password: YOUR_PASSWORD" "https://www.nationstates.net/cgi-bin/api.cgi?nation=YOUR_NATION&q=unread"
curl -A "YOUR_USER_AGENT" -H "Password: YOUR_PASSWORD" -I "https://www.nationstates.net/cgi-bin/api.cgi?nation=YOUR_NATION&q=unread"
curl -A "YOUR_USER_AGENT" -H "Password: YOUR_PASSWORD" -D - "https://www.nationstates.net/cgi-bin/api.cgi?nation=YOUR_NATION&q=unread"
by HMS Unicorn » Mon Aug 22, 2016 6:22 am
[violet] wrote:I've added "Private Shards," for when you want to access information that's only available to a logged-in nation.
For now the only shard is "unread", which will tell you how many new TGs, Issues, etc, you have. But I aim to expand it in the future to cover telegrams, issues, and more. So please give this a test and let me know what you think.
For details see "Private Shards" in the API doc!
by Maplou » Mon Aug 22, 2016 1:08 pm
HMS Unicorn wrote:Maplou wrote:Is there anyone who has an example of private shards with curl for php or any other method to get it over the web?
The API shows an example, which needs to be modified a little bit for a legal API call. If you want to get the unread data, here is how you should edit it1:Note that https is necessary, simply http won't work. You can replace "Password" with the autologin code or pin if that's what you want to use.
- Code: Select all
curl -A "YOUR_USER_AGENT" -H "Password: YOUR_PASSWORD" "https://www.nationstates.net/cgi-bin/api.cgi?nation=YOUR_NATION&q=unread"
If you want to see the headers containing the pin or autologin code, you should use this:Then in the response, search for the line "X-pin" or "X-autologin" as appropriate.
- Code: Select all
curl -A "YOUR_USER_AGENT" -H "Password: YOUR_PASSWORD" -I "https://www.nationstates.net/cgi-bin/api.cgi?nation=YOUR_NATION&q=unread"
Finally, if you want to see both the headers and the actual unread data, you should use this:Note the dash, -, after -D, it is not a typo.
- Code: Select all
curl -A "YOUR_USER_AGENT" -H "Password: YOUR_PASSWORD" -D - "https://www.nationstates.net/cgi-bin/api.cgi?nation=YOUR_NATION&q=unread"
1It is possible to include the user-agent as part of the request headers passed with -H, but I prefer to set it separately using the -A flag.
by Scilla » Mon Aug 22, 2016 6:34 pm
by Flanderlion » Mon Aug 22, 2016 7:44 pm
Scilla wrote:So I am making a discord chatbot using discord.js and I want to have a command where you type !nationname: (and then the name of the nation), and it would reply with a link to the nation you just named. One of my regionmates did the same, only in another language. How would I do this? Do I need NS Api?
by [violet] » Mon Aug 22, 2016 8:36 pm
Flanderlion wrote:On topic though - is there any way to get just the new notifications rather than the last X notifications with the new shard?
Advertisement
Users browsing this forum: No registered users
Advertisement