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
Ballotonia
Senior Admin
 
Posts: 5494
Founded: Antiquity
Democratic Socialists

Postby Ballotonia » Thu Mar 22, 2012 1:09 am

The Blaatschapen wrote:Is it also possible to have it the other way around? Ie. An API that shows which regions have @@TAG@@ ?


That would be useful for me as well, but in my case it would be to remove classroom nations from my dossier. (or better phrased: remove them from the list of nations I'm adding to my dossier, before actually adding them)

Ballotonia
"Een volk dat voor tirannen zwicht zal meer dan lijf en goed verliezen, dan dooft het licht…" -- H.M. van Randwijk

User avatar
Poopcannon
Bureaucrat
 
Posts: 47
Founded: Sep 28, 2004
Ex-Nation

New Nations

Postby Poopcannon » Sun Apr 08, 2012 5:24 pm

Would it be possible to get a list of the newest nations that only returns recruitable nations, eg ones that are still in the feeders?

As it is, my script has to check each nation on the list until it gets to an acceptable nation, or compare the list against the list of nations in each of the feeders. If I could be certain I can sent them a TG without having to do any checks beforehand, it could hugely reduce my calls to the API.

User avatar
[violet]
Executive Director
 
Posts: 16301
Founded: Antiquity

Postby [violet] » Mon Apr 09, 2012 5:39 pm

I'm probably not going to add that, since it would be obsoleted by the new recruiting stuff in the forthcoming TG system. Sorry--I appreciate that the current way is kind of a pain.

User avatar
Poopcannon
Bureaucrat
 
Posts: 47
Founded: Sep 28, 2004
Ex-Nation

Postby Poopcannon » Thu Apr 12, 2012 7:45 pm

I don't mind, it's only a few extra lines of code for me. I was just thinking these extra calls to the API could be removed with a small change on your side. I'm looking forward to seeing this new TG system now!

On the topic of API access for recruiting, what is the legality of a recruitment program logging and sending TGs as several different nations for several different regions?

Considering the rules say it's judged on a per region basis, and each telegram is for a different region, would this be ok with you guys, or would it be a problem?
Last edited by Poopcannon on Thu Apr 12, 2012 7:47 pm, edited 1 time in total.

User avatar
Frisbeeteria
Game Moderator
 
Posts: 28039
Founded: Dec 16, 2003
Capitalizt

Postby Frisbeeteria » Thu Apr 12, 2012 8:12 pm

Poopcannon wrote:On the topic of API access for recruiting, what is the legality of a recruitment program logging and sending TGs as several different nations for several different regions?

Considering the rules say it's judged on a per region basis, and each telegram is for a different region, would this be ok with you guys, or would it be a problem?

If you're running a single script for multiple regions, you would need to adhere to the posted API limit of no more than 3 TGs per minute, regardless of which region it was promoting. I recognize that there is a contradiction there, but we're going to err on the side of caution and fairness. You've already got a huge advantage over manual scripters, so you don't need a break here. We'd also hope you wouldn't slam the API with multiple newnations shard requests, as that information could easily be shared amongst regions.

If you've shared / licensed your script to other players, each of them would be considered an independent script. They would of course have to comply with script rules both on the forums and in the API doc, including a properly defined UserAgent for each copy.



You do realize that by promoting multiple regions, you make the very concept of TG scripts more hated and spamlike, lessening the chance of any one of your regional TGs working? Ruling aside, it seems to me like you want scripting to fail.

User avatar
[violet]
Executive Director
 
Posts: 16301
Founded: Antiquity

Postby [violet] » Fri Apr 13, 2012 12:00 am

Yes, if you're sending TGs out as a service, you can still only send 3 per minute, regardless of how many different regions you're promoting, or how many nations you use to send them.

User avatar
Poopcannon
Bureaucrat
 
Posts: 47
Founded: Sep 28, 2004
Ex-Nation

Postby Poopcannon » Fri Apr 13, 2012 12:16 am

Thanks for the line in the sand.

I'm quite aware of how people feel about recruitment scripts. That's also why several regions have asked for access to our scripts. I was wondering what the best way to help them out would be. Not everyone has the technical skills to run it themselves, which is why I was wondering if I could run it for them.

User avatar
Crushing Our Enemies
Ambassador
 
Posts: 1413
Founded: Nov 16, 2004
Corporate Police State

Postby Crushing Our Enemies » Sun Apr 15, 2012 2:16 pm

I have a question about the API. In the documentation, it says to pull a shard from the region API, you use this URL: http://www.nationstates.net/cgi-bin/api ... gion=(name)&q=(shard1)+(shard2)+(...)

Is there a way to pull shards from more than one region at once, by modifying the url in some way? Forgive my complete and total ignorance in these matters. I understand one can simply enough just use multiple urls to do what I'm trying to do, but it would be somewhat neato if this could work with just one. Any advice will be appreciated!
[violet] wrote:You are definitely not genial.
[violet] wrote:Congratulations to Crushing Our Enemies for making the first ever purchase. :)

User avatar
Scoochi2
Envoy
 
Posts: 207
Founded: Antiquity
Ex-Nation

Postby Scoochi2 » Sun Apr 15, 2012 6:22 pm

Frisbeeteria wrote:If you've shared / licensed your script to other players, each of them would be considered an independent script. They would of course have to comply with script rules both on the forums and in the API doc, including a properly defined UserAgent for each copy.

If a script operates on a server with various users taking advantage of it, does that still fall under the "sharing/licensing" clause? I'm not currently running any, but have run into API overuse issues in the past via this method.
If I were to resolve the API issue by local caching, would the script still be allowed to send 3 TGs per minute for each separate user (each for a different region/cause)?
The problem with a UDP joke is that you have no idea if people got it.

User avatar
Frisbeeteria
Game Moderator
 
Posts: 28039
Founded: Dec 16, 2003
Capitalizt

Postby Frisbeeteria » Sun Apr 15, 2012 7:50 pm

Scoochi2 wrote:If a script operates on a server with various users taking advantage of it, does that still fall under the "sharing/licensing" clause?

Yes. One machine running a script with a single UserAgent will be seen as the same user. Even if each user is logged into a different session, the process will look like a single set of calls.

Scoochi2 wrote:If I were to resolve the API issue by local caching, would the script still be allowed to send 3 TGs per minute for each separate user (each for a different region/cause)?

No. Throttle your script down to 3/minute regardless of the number of users. Nobody needs to send 3/minute to keep up with new nation creation, which is running at a much slower rate.

Scoochi2 wrote:I'm not currently running any ...

I'm not interested in any more hypothetical rules-lawyering questions so that someone can push the absolute limit of the rules. Automation gives script users an extremely unfair advantage already. Be satisfied that we allow it at all.

User avatar
Glen-Rhodes
Powerbroker
 
Posts: 9027
Founded: Jun 25, 2008
Ex-Nation

Postby Glen-Rhodes » Sun Apr 15, 2012 8:48 pm

Frisbeeteria wrote:I'm not interested in any more hypothetical rules-lawyering questions so that someone can push the absolute limit of the rules. Automation gives script users an extremely unfair advantage already. Be satisfied that we allow it at all.

I'd like to point out that given that punishments for breaking the scripting rules (both game rules and technical rules) are very severe, any responsible scripter will want to ask these hypotheticals. If we write something that breaks the rules, because we don't ask about it beforehand, we can easily be banned from the game and have our server banned from accessing the API. So I don't think you guys should be discouraging scripters from asking hypotheticals into order to figure out exactly what's allowed under the rules.

Additionally, the rules are still developing; we're still having conversations about them. There's not much detail in the OSRS. The API is new and the telegram automation rules are new, so there's not a lot of mod precedent scripters can look to. It'd be better that we ask now and not get banned for scripting something that's ultimately illegal, rather than script something that we think is legal and get banned for doing it. :\

I don't know if that's the message you were trying to get across, but that's how it came across to me. Sorry if I've misinterpreted you.
Last edited by Glen-Rhodes on Sun Apr 15, 2012 8:49 pm, edited 2 times in total.

User avatar
Frisbeeteria
Game Moderator
 
Posts: 28039
Founded: Dec 16, 2003
Capitalizt

Postby Frisbeeteria » Sun Apr 15, 2012 9:29 pm

Glen-Rhodes wrote:It'd be better that we ask now and not get banned for scripting something that's ultimately illegal, rather than script something that we think is legal and get banned for doing it.

I have no problems with scripters asking about something they're trying to write. My problem is with rules lawyers looking for a hole in the rules, then writing a script to sneak through it. My real problem is with some basically honest person doing so as an intellectual exercise, opening the door for someone less honest to exploit it privately after having it exposed publicly.

If you have legitimate questions related to something you're working on, ask them. We'll do our best to answer them.

User avatar
[violet]
Executive Director
 
Posts: 16301
Founded: Antiquity

Postby [violet] » Mon Apr 16, 2012 4:34 pm

Crushing Our Enemies wrote:Is there a way to pull shards from more than one region at once, by modifying the url in some way?

No, there isn't.

User avatar
[violet]
Executive Director
 
Posts: 16301
Founded: Antiquity

Postby [violet] » Mon Apr 16, 2012 4:39 pm

If there are questions about script rules, which have nothing to do with the API, then please take them to an appropriate thread. We have the original "Script Rules" discussion, for technical questions, and the more recent "On the legalisation of automatic recruitment" for a broader discussion.

User avatar
[violet]
Executive Director
 
Posts: 16301
Founded: Antiquity

Postby [violet] » Mon Apr 16, 2012 4:42 pm

Glen-Rhodes wrote:I'd like to point out that given that punishments for breaking the scripting rules (both game rules and technical rules) are very severe, any responsible scripter will want to ask these hypotheticals. If we write something that breaks the rules, because we don't ask about it beforehand, we can easily be banned from the game

This is completely incorrect. We have never banned anyone for a misconfigured script. On the contrary, we have gone to great lengths to contact and assist script writers who inadvertently break the rules.

User avatar
Frisbeeteria
Game Moderator
 
Posts: 28039
Founded: Dec 16, 2003
Capitalizt

Postby Frisbeeteria » Mon Apr 16, 2012 5:52 pm

[violet] wrote:This is completely incorrect. We have never banned anyone for a misconfigured script. On the contrary, we have gone to great lengths to contact and assist script writers who inadvertently break the rules.

Ehhhh ... sorry to correct you, boss, but we have. Twice.

The first was when that player went off to college and forgot to turn off his cron job, so we blocked his IP until he noticed his script failing. The second was one of the TG scripters who was exceeding the three per minute rule, but that one got straightened out in a couple of days. We actually left a puppet banned for use in scripting timing testing, at the player's request.

We've never banned a player, mind you - just the server IPs associated with rogue scripts.

User avatar
[violet]
Executive Director
 
Posts: 16301
Founded: Antiquity

Postby [violet] » Wed Apr 18, 2012 10:16 pm

Frisbeeteria wrote:We've never banned a player, mind you - just the server IPs associated with rogue scripts.

That's what I said.

Scripts themselves get banned quite a lot; e.g. if they exceed the API rate limit, they get blocked for 15 minutes or so, to control server load. That happens many times a day.

But we do not ban script authors for inadvertently breaking a rule, and never have.

User avatar
Glen-Rhodes
Powerbroker
 
Posts: 9027
Founded: Jun 25, 2008
Ex-Nation

Postby Glen-Rhodes » Fri Apr 20, 2012 9:07 am

Sorry, but it didn't seem out of the question, given the escalating drama over several different scripts/exploits in recent history.

Anyways, on to something actually dealing with the API. Actually, this doesn't have to deal with nationdata/regiondata API. I was wondering if it would be possible to implemented OAuth for NationStates. A while ago, I started writing a secure third-party election tool for any region that would want to use it. But I quickly ran into the issue of being able to verify that the person saying they're Testlandia is really Testlandia. I thought about doing it in a hack-ish way by loading NationStates in a frame and checking the sidebar for the word "Testlandia." But that can be easily manipulated and wouldn't support users who are blocking frames. Also, it's just hack-ish and I wanted to avoid that.

The perfect solution would be OAuth, where I can send the user to NationStates for verification, and NationStates can send them back to me, telling me that they're verified. In this scenario, all I want to do is authenticate, which is probably more appropriate for OpenID. But I imagine there are other scenarios where a third-party application might want authorization to do actions on behalf of that nation. Maybe storing telegrams or dossier reports, or maybe managing endorsements, I don't know. Also, few people know how to work OpenID, but everybody with a Facebook account would be familiar with the OAuth process. That alone makes it a better option in my eyes.

Honestly, though, I just wish there was a way for third-party tools to verify that people are who they say they are. It doesn't matter to me how it might be done, just that it be easy for users and relatively easy for developers to implement.

User avatar
Solm
Senator
 
Posts: 3582
Founded: Jul 23, 2008
Corporate Bordello

Postby Solm » Sat Apr 21, 2012 4:45 pm

[violet], do you think it would be possible to add a shard for the WA recent events? Similar to the region shard for regional happenings, but for WA recent events? It would make things much easier so I don't have to scrape the WA page just to get the recent events there.

Thank You!

Retired: ns .hellodot. solm @ gmail .dot. com

User avatar
[violet]
Executive Director
 
Posts: 16301
Founded: Antiquity

Postby [violet] » Sun Apr 22, 2012 6:56 pm

Glen-Rhodes wrote:Anyways, on to something actually dealing with the API. Actually, this doesn't have to deal with nationdata/regiondata API. I was wondering if it would be possible to implemented OAuth for NationStates.

We were discussing this recently, for the reasons you mention. It looks tricky. I believe I told Ballotonia to figure it out. :)

Solm wrote:[violet], do you think it would be possible to add a shard for the WA recent events? Similar to the region shard for regional happenings, but for WA recent events? It would make things much easier so I don't have to scrape the WA page just to get the recent events there.

That sounds like a great idea for Ballotonia.

User avatar
Ballotonia
Senior Admin
 
Posts: 5494
Founded: Antiquity
Democratic Socialists

Postby Ballotonia » Mon Apr 23, 2012 6:15 am

[violet] wrote:We were discussing this recently, for the reasons you mention. It looks tricky. I believe I told Ballotonia to figure it out. :)


I do not recall that, but I'll be happy to dive into this and see what I can dig up.

[violet] wrote:That sounds like a great idea for Ballotonia.


Oh... the great shoving-things-in-my-direction has started :P

That's cool, it leaves you more time to focus on the Telegram System rework. Win-win!

Ballotonia
Last edited by Ballotonia on Mon Apr 23, 2012 6:16 am, edited 1 time in total.
"Een volk dat voor tirannen zwicht zal meer dan lijf en goed verliezen, dan dooft het licht…" -- H.M. van Randwijk

User avatar
Zemnaya Svoboda
Diplomat
 
Posts: 867
Founded: Jan 06, 2004
Civil Rights Lovefest

Postby Zemnaya Svoboda » Mon Apr 23, 2012 9:23 am

Ballotonia wrote:
[violet] wrote:We were discussing this recently, for the reasons you mention. It looks tricky. I believe I told Ballotonia to figure it out. :)


I do not recall that, but I'll be happy to dive into this and see what I can dig up.

[violet] wrote:That sounds like a great idea for Ballotonia.


Oh... the great shoving-things-in-my-direction has started :P

That's cool, it leaves you more time to focus on the Telegram System rework. Win-win!

Ballotonia

:bow:

I came here to ask about WA happenings, and was happy to see it'd already been asked :)


edit2: I show some pre-emptive gratitude.
Last edited by Zemnaya Svoboda on Mon Apr 23, 2012 10:59 am, edited 2 times in total.

User avatar
Poopcannon
Bureaucrat
 
Posts: 47
Founded: Sep 28, 2004
Ex-Nation

Postby Poopcannon » Tue Apr 24, 2012 6:57 am

Not sure if this is really the right place for this, but you should consider having an option for outputting the data in a json format. It would reduce a bit of server load since you don't have to wrap everything in heavy XML tags, so you save on the overall size of the document sent.

There are also plenty of facilities for parsing json arrays for script writers. In PHP, for example, there's one small function for parsing a json object to an associative array. Considering some people have had problems parsing XML, this might be a nice idea.

User avatar
Zemnaya Svoboda
Diplomat
 
Posts: 867
Founded: Jan 06, 2004
Civil Rights Lovefest

Postby Zemnaya Svoboda » Tue Apr 24, 2012 7:03 am

Poopcannon wrote:Not sure if this is really the right place for this, but you should consider having an option for outputting the data in a json format. It would reduce a bit of server load since you don't have to wrap everything in heavy XML tags, so you save on the overall size of the document sent.

There are also plenty of facilities for parsing json arrays for script writers. In PHP, for example, there's one small function for parsing a json object to an associative array. Considering some people have had problems parsing XML, this might be a nice idea.

Perl JSON
The mapping from Perl to JSON is slightly more difficult, as Perl is a truly typeless language, so we can only guess which JSON type is meant by a Perl value.


I do not know if the developers have time to jump through whatever hurdles are caused by that.

User avatar
[violet]
Executive Director
 
Posts: 16301
Founded: Antiquity

Postby [violet] » Tue Apr 24, 2012 4:50 pm

Poopcannon wrote:Not sure if this is really the right place for this, but you should consider having an option for outputting the data in a json format.

That's what I'd do if I were creating the API today. As it is, I don't think there's sufficient demand to migrate, which would take some work.

We don't really have a bandwidth problem; our bottleneck is generating the data to output, regardless of what format we wrap it in.

PreviousNext

Advertisement

Remove ads

Return to Technical

Who is online

Users browsing this forum: Tekniania, Tiami, Valoptia, Zzznxz

Advertisement

Remove ads