simple-leaderboard-api

An API for implementing leaderboards into your games

How to use it

Use the application above to get your GameID. A GameID is unique to your game and email. You can have multiple games under the same email, but to get a new GameID you'll need a new Game to generate it.

Once you have the GameID, you'll generally make GET requests to the API in exchange for your leaderboard stats.

Actions

The base URL for the API is https://geraldburke.com/apis/simple-leaderboard-api/

To make a call, you must specify an action. There are three of these.

newScore

This will look like https://geraldburke.com/apis/simple-leaderboard-api/?action=newScore

This is how you will add new scores to the leaderboard.

This endpoint take 3 paramaters. All three must have a value to make a successful call.

  1. gameID - The unique number you receive when you sign up with your email
  2. score - The numeric value of the user score. It's an integer, so be kind with your scale
  3. userName - The name of the user that got the score

A complete request to add a new score should look something like this

https://geraldburke.com/apis/simple-leaderboard-api/?action=newScore&gameID=1&score=1000&userName=geraldfingburke

Verbose, isn't it? I promised a simple api, not a short one.

topScores

This will look like https://geraldburke.com/apis/simple-leaderboard-api/?action=topScores

This is how you will read values from the leaderboard.

This endpoint has two paramaters (and one of them is optional!)

  1. gameID - The unique number you receive when you sign up with your email
  2. count - The number of scores to pull. If you leave this off, you'll just get ten. If there are fewer records than the count, you'll get what you have.

A complete request to get top scores should look like this

https://geraldburke.com/apis/simple-leaderboard-api/?action=topScores&gameID=1&count=10

Remember, you can leave off the count. As a matter of fact, since the default is 10, there is virtually no difference between that call and a call without the count parameter.

userScores

This will look like https://geraldburke.com/apis/simple-leaderboard-api/?action=userScores

This one lets you get scores by the name of the user that scored them.

This endpoint brings us back to three parameters (still one optional!)

  1. gameID - The unique number you receive when you sign up with your email
  2. userName - The name of the user you want to get scores for
  3. count - The number of scores to pull. If you leave this off, you'll just get ten. If there are fewer records than the count, you'll get what you have.

https://geraldburke.com/apis/simple-leaderboard-api/?action=userScores&gameID=1&userName=geraldfingburke&count=10

Remember, you can leave off the count. As a matter of fact, since the default is 10, there is virtually no difference between that call and a call without the count parameter.

Attribution and License Info

I don't actually know what the license is, I just picked one that sounded permissive. That is the spirit of this endeavor. Feel free to use this however you would like.

I don't need myself or the project to be credited if you do use this, but I absolutely love to hear when people use my work, so if you want to shoot me a message with a link to your thing, I would love to check it out.

Updated 21 days ago
StatusReleased
CategoryOther
PlatformsHTML5
Rating
Rated 5.0 out of 5 stars
(1 total ratings)
AuthorGerald Burke
Tagsapi, asset, leaderboard

Comments

Log in with itch.io to leave a comment.

(+1)

It seems like this is not working.  Is that expected?

It is not! I completely forgot to update the itch build of this. If you still need to use it, you can do so here:

https://github.com/geraldfingburke/simple-leaderboard-api

If you already tried that and it didn't work, it's because the links were out of date as well. I just updated my site a few weeks ago and completely forgot to update the other services I run on it. Everything should be current and it appears to be working.

(1 edit) (+1)

Thank you--this is great to know!  I was still a bit confused by the indiealchemy.com links above that are out of date, but the links provided at your github.com repo do work.  

Thanks for providing this service!

Absolutely! And thank you for the callout. I've now updated the itch page with the current version and links.