Query OpenFeint LeaderBoard List

I don't know if this is possible but it would be great to be able to ask OpenFeint what the highest score is and pass that value to corona to be able to display as we wish. This all done without opening the openfeint interface.

I think this is possible through OpenFeint's RESTful api, more info here:

http://www.openfeint.com/ofdeveloper/index.php/kb/article/000075

The best way would be to follow the api above using Corona's http functions.

Say I want to get the highest score, date and name of the person.

Let me see if I get this right. I should use the following procedure to get a returned JSON file to the app.

How to get a list of High Scores

Use this request to get the actual highscores associated with a leaderboard. You will need aleaderboard_id in order to make this request. You can get the leaderboard_id by getting the list of leaderboards (see How to get a list of Leaderboards). The response of a highscores request is paginated, meaning that only a limited number of results are shown at a time. By default, 30 entries are shown at a time. In order to see more results, you must pass in a page parameter into the request. If you want to see more results per page, you can pass in a per_page parameter to set the number of results returned per page.

Request format:

/api/games/:client_application_id/leaderboards/:leaderboard_id/highscores(.:format)

Example:

http://api.openfeint.com/api/games/943342882/leaderboards/746115022/highscores.xml

What is returned:
score: the actual score recorded.
created_at: when the highscore was first created.
updated_at: when the highscore was updated.
display_text: any custom display text associated with the highscore.
user: the following is the user data associated with the highscore
name: name of the user who got the score.
profile_picture_url: the url of the profile picture associated with the user.
open_feint_gamer_score: the openfeint score associated with the user

I would get 30 results back through this method.
Then I would have to sort it through the JSON functions and get the highest score and info associated with it. Then I would have to store that on some variables in my app and display it where I want it.

views:2030 update:2011/9/19 9:18:26
corona forums © 2003-2011