↕️REST API
If you use an engine other than Unity, Cordova, or HTML5, you can access our service through a REST API. Send data as JSON (not form data) when testing.
Get Token
POST
https://api.galaxysdk.com/api/v1/signup/anonymous
Get an anonymous token for this user. You'll need this to make subsequent calls
Headers
Name | Type | Description |
---|---|---|
Publishable-Key | String | The game's publishable key |
Request Body
Name | Type | Description |
---|---|---|
device_id | String | Unique identifier for this device |
Player ID: Get the player ID from the token by decoding the base64 string and extracting the value under the user_id
key.
Submit score (client)
POST
https://api.galaxysdk.com/api/v1/client/leaderboards/:leaderboard_id/report_score
Submit a score from the client.
Path Parameters
Name | Type | Description |
---|---|---|
leaderboard_id* | String | Path parameter of the leaderboard ID you want to get |
Headers
Name | Type | Description |
---|---|---|
Publishable-Key* | String | The game's publishable key |
Anonymous-Authorization* | String | An anonymous user's token |
Request Body
Name | Type | Description |
---|---|---|
score* | Number | The score |
Submit score (server)
POST
https://api.galaxysdk.com/api/v1/server/report_scores
Submit a score from the server. Update a player's scores on leaderboards. Each index in the scores array corresponds to the index in the leaderboard array. For example,
leaderboard_ids: ["mygame.coins", "mygame.totalscore"]
scores: [155, 2940]
would update this player's best score to 155 on the coins leaderboard and 2940 on the totalscore leaderboard.
Headers
Name | Type | Description |
---|---|---|
Secret-Key* | String | Your server API Key |
Request Body
Name | Type | Description |
---|---|---|
player_id* | String | Galaxy Player ID |
scores* | [Double] | Array of corresponding scores for each leaderboard ID |
leaderboard_ids* | [String] | Array of leaderboard IDs to update |
Get player record
GET
https://api.galaxysdk.com/api/v1/client/leaderboards/:leaderboard_id/players/:player_id
Submit a score from the server. Update a player's scores on leaderboards. Each index in the scores array corresponds to the index in the leaderboard array. For example,
leaderboard_ids: ["mygame.coins", "mygame.totalscore"]
scores: [155, 2940]
would update this player's best score to 155 on the coins leaderboard and 2940 on the totalscore leaderboard.
Headers
Name | Type | Description |
---|---|---|
Secret-Key* | String | Your server API Key |
Request Body
Name | Type | Description |
---|---|---|
player_id* | String | Galaxy Player ID |
scores* | [Double] | Array of corresponding scores for each leaderboard ID |
leaderboard_ids* | [String] | Array of leaderboard IDs to update |
See Data Types for obejct descriptions
Show the leaderboard
Open this URL in a webview or in app browser:
https://app.galaxy.us/leaderboards/:leaderboard_id?token=<token>&hideCloseButton=true
Change hideCloseButton
to false if you want to use the close button in the UI. However, you need to listen for URLs with query string sdk_action=close_window
and close the webview.
Show the avatar
Get the avatar image from this URL:
https://api.galaxysdk.com/api/v1/users/{galaxy player id}/avatar.png
Last updated