Sign In Register

How can we help you today?

Start a new topic

public webapi URL

Is there a way to create a public web api url using gamesparks?

Ultimately my goal is to pull select information, like a list of all usernames, their stats[level,currency, achievements,etc] and create a discord bot & website that pulls the info from gamesparks and organizes it all nice and clean.
Example, discord bot will be able to pull each users stats & website will compare all the values in a visually clean way.

I want to skip the auth token part (if possible) and set certain information within gamesparks to be publicly readable but not modified unless authenticated. This in theory to mean means that if I can make the information, is there a way to make this possible? I understand there are ways to create webservers and all that.. but I want to skip that painful process of developing that from scratch because the documentation seems to be heavily outdated.

is there a way to create an authtoken, that's set to not expire and then put that into a url string which then I can use to parse the database of players? Example.

If this is not at all possible.. can gamesparks make some sort of template for making a basic stat tracking website using nodejs?(the example project is not exactly what I am looking for.. I need to find  ALL of the players and ALL of their information and then be able to render that to a webpage, the example project only pulls 1 person details and only displays it.

Hi Cody,

You have 2 options to go about this sort of functionality.

1. Use our Rest API to pull user information directly from GameSparks via querying the NoSQL Database. 

2. Create a callback URL to hit and run some code to return in a response. This is the most common way users expose a public gateway to GameSparks, however, it is important to note that the callback script has the same 30 second limit on execution time, if you are querying and transforming a particularly large body of data then it's better to go the Rest API route. It would work fine in the event that you wanted to get information about 1 user, for example.


I'm trying the rest api method. I can  finally get the response back.. seee below


 Is there a way to just simply list all of the players using the path name or even set the limited amount of players it returns it in the path name? ?example - /restv2/game/{apikey}/mongo/collections/player/list=10

Below is the code/path I'm attempting to use to pull all of the  players info but i'm getting 403 errors. 

function noSqlRes(jwtToken) {
	var nReq = {
		host: '{URL}',
		path: '/restv2/game/{apikey}/mongo/collections/player/',
		headers: {
			'X-GS-JWT': jwtToken


Hi cody,

By supplying a dto object in the body of the request you can fulfill a query function.

You can provide the following as part of the request:


  "fields": {},

  "limit": 0,

  "query": {},

  "skip": 0,

  "sort": {}


In terms of getting a 403 error, this indicates your jwt token does not have the proper auth necessary to fulfill the request.

You can test out this request through our swagger api here. Furthermore, here is an example of what a proper request would look like in cURL if I wanted to get a single player from the player collection:

curl -X POST --header 'Content-Type: application/json;charset=UTF-8' --header 'Accept: application/json' --header 'X-GS-JWT: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJnYW1lSWQiOjMwNjc2NywiY291bnRyeSI6IklFIiwiYXBpS2V5IjoiYTMwNjc2N29aOXFNIiwicGVybWlzc2lvbnMiOnsiYTMwNjc2N29aOXFNIjp7Im5vc3FsIjoyfX0sInJvbGVzIjoiUk9MRV9BRE1JTixST0xFX1JFQURPTkxZX0FETUlOIiwiZ3JvdXBzIjoiZ3Nyb2xlLmdhbWVBZG1pbiIsInVzZXJOYW1lIjoicGFkcmFpZy5vY29ubm9yQGdhbWVzcGFya3MuY29tIiwiZXhwIjoxNTExMzUzMTMxLCJ1c2VySWQiOjI2NjI3OCwiaXNzdWVyIjoiYXV0aC5nYW1lc3BhcmtzLm5ldCJ9.MBDjgvdq3fJ_pZeGuflpiq1mbOd7emeK7w2Igciif-o' -d '{"query":{"userName":"padraig"},"sort": {}}' 'https://<apikey><apikey>/mongo/collection/player/find'

Please let us know if you have any additional questions or clarifications.


How can I get the jwt token from my own application? Exist any way to do this? I want to implement user authentication for my users can see and update data with my client.

Login to post a comment