Skip to content

Instantly share code, notes, and snippets.

View postScore.js
//URL
/*
https://preview.gamesparks.net/callback/<gameAPIKey>/postScore/<credentialSecret>?
score=<playerScore> -- Needs to always be called score but it could represent anything. Whatever is being counted by the event.
&password=<playerPassword>
&username=<playerUsername>
&eventname=<leaderboardEventName> -- The name of the event that is attached to the leaderboard.
View retrieveleaderboard.js
//url:
/*
https://preview.gamesparks.net/callback/<appKey>/retrieveLeaderboard/<credentialSecret>?
aroundme=true& -- Return scores above and below current user. Omit if you want the top of the leaderboard.
leaderboardname=<shotnameofleaderboard>& -- Name of the leaderboard.
entrycount=<number of entries>& -- How many entries to return. If aroundMe is included in the call this number will be the records returned above and below the user otherwise this will be the total number of records.
username=<player user name>& -- Username of player.
password=<player password> -- Password of player.
*/
View saveandload.js
//Get url: https://preview.gamesparks.net/callback/<apiKey>/savePlayerTable/<credential secret>?username=<username>&password=<user password>&tablename=<table name>
//Save url: https://preview.gamesparks.net/callback/<apiKey>/getPlayerTable/<credential secret>?username=<username>&password=<user password>&tablename=<table name>
//Get Code
var uPwd = Spark.getData().password;
var uName = Spark.getData().username;
var uTableName = Spark.getData().tablename;
View registerlogin.js
//Login URL:
//https://preview.gamesparks.net/callback/<yourAPIKey>/userLogin/<yourCredentialSecret>?username=<username>&password=<password>
//Register URL:
//https://preview.gamesparks.net/callback/<yourAPIKey>/register/<yourCredentialSecret>?username=<username>&password=<password>&displayName=<displayName>
//The login code:
var uPwd = Spark.getData().password;