Monday, May 24, 2010

Lasuni API

(Updated 05/25/2010)

Hey Lasoons,

You've all been asking for some sort of API, so we've created one for you. Though this API won't be permanent, it should last a while, at least until we have the time to create a much better one.

As of now, you can pull a bit of data from Lasuni, such as the top 10 richest players, top 10 selling items, and the number of online players. To do this, you'll need to know how JSON works, and a programming language that can utilize it.

To pull data, the url will be http://api.lasuni.com/data.php?p={data}

Where {data} is the specific data you want to pull. Below is the list of acceptable values:
  • best_selling
  • online
  • richest
  • userdata : &user={username}
  • today
If you enter either one of these values, it will return a JSON array of the data. For best_selling, it pulls the 10 best selling items, contained in the element "items", each one is a separate array containing the elements "title" and "icon". For the icon, be sure to include "http://images.lasuni.com/icons/" before the actual icon file for it to show up.

The item "online" returns one element, "count", which simply has the number of online users.

The "richest" element is an array named "users", each item is the user's name.

To pull user data, simply set "p=userdata" and then set "user={username}" replacing {username} with the name of the desired user. This will either return an error (stating the user does not exist), or another JSON array containing the userdata for this user.

The user data that's pulled is: Name, Mission, Gender, Level, Color, Online (true/false), and the creation date of the account.

For error checking, you'll notice there is always the element "error", and it should always be blank. If it is not blank, then there is an error, and the "error" element will contain the actual error message.

Please be aware that we may update the way the API works in the future, so the way it works now will not always be the way it works in the future. We are making no guarantee that it'll work the way you want, and we hold no responsibility or liability for any problems that may arise from the use of our API.

If you have any problems or questions pertaining to the API, please make a comment on this blog post, or open a help ticket. Though we cannot provide support on making applications for it, but we can try to help if you have any questions.

If you have any special feature requests for it as well, let us know!

4 replies:

  1. A great help would be to offer an API that allows us to check if a username exists. Something like data.php?p=userexists&u=xLite could return true or false or {"exists":"true/false"} :D
    ReplyDelete
  2. I've added something similar Calum :) Look at "userdata"
    ReplyDelete
  3. Another suggestion, this wll no doubt take a while to implement so I only ask you consider it. :P Basically a system similar to oAuth where basically you offer api keys or "secret" keys along with an account id or application id to allow us to authenticate users signing up to external services. This way we can provide special benefits based on their account such as currently the userdata api. Basically it would be similar to api.php?p=authorize&app_id=123&redirect=myfansite.com/login_success_check, the fansite would direct users to this url, they login safely on Lasuni's domain and it redirects back to the process page specified which checks if the authentication was successful. This would be very handy :D
    ReplyDelete
  4. We have plans for a similar system in the future, but it won't be available for quite some time.
    ReplyDelete