I just switched from Steam leaderboard to GameSparks leaderboard and I want to import the Steam leaderboard data to GameSparks collections.
I though I could use cloud code and the function Spark.sendRequestAs. My question is in what kind of cloud code can I use this function ? Currently, I have created a custom event and hooked the following script to it:
I also tried the same thing but directly connecting from the nodejs sdk (found here:https://bitbucket.org/gamesparks/gamesparks-node-server-sdk) but this time without player authentication (I'm using the server url with the server secret from credentials panel). In this case, I'm directly sending the with the correct playerid, but again I have authentication issue.
I found very little documentation about the function Spark.sendRequestAs and about the credentials parameters for integrating with other server. Any idea how I can achieve this ?
Thanks for your help
Best Answer
C
Customer Support
said
about 2 years ago
Hi Vincent,
Apologies for the delayed response. How many players in total do you need to do this for ? You can read about Security Credentials here and how to use them here. In this case I think a BatchAdminRequest or ScheduleBulkJobAdminRequest would be the best way to achieve this. You can read more about how to execute a bulk job here. So if you export the Steam Leaderboard data and then upload it to a GameSparks collection in Json format you could have an event or script that will search for the matching SteamId and then post it to the GameSparks Leaderboard. While using a BatchAdminRequest you would supply the playerIds (up to 500 at a time) of the players who have scores you like to re post, you would supply an event that you want to run against each player in Json format, check below for an example.
//request sent from Test Harness
{
"@class": ".BatchAdminRequest",
"playerIds": [
"570b686ef528a1ccf49e8a6b","570d48a8f528a1ccf49e9f25","570e1319808eb904a5e33677" //etc....
],
"request": {
"@class": ".LogEventRequest",
"eventKey": "repostScores"
}
}
In Cloud Code for the event supplied in this BatchAdminRequest you could do use "var extIds = Spark.getPlayer().getExternalIds();" and check if the players steam ID is located in the collection of Steam scores you uploaded. If it is, then use a SparkRequest to post it to the GameSparks Leaderboard. Using a ScheduleBulkJobAdminRequest would work in a similar way only it would run a supplied script on players that match the query in the request. Here you could check the player collection and if a player has a steamId then check if they have an entry in the steam leaderboard collection you uploaded, if they do, post the score found there for them. To send either of these requests form the Test Harness you need to enable them in "debug" in the credentials window in integrations. If you navigate to there in the portal and click edit on "debug" you can click on the admin tab and enable the admin requests you require. These can now be sent from the Test Harness as a game admin user, you don't need to authenticate as a player to do this.
Let me know if this helps, if you need any further assistance just let us know.
You won't be able to send any data to GameSparks if you are not authorized. Can you give us some samples of the Steam Leaderboard data so we can look into the best way to get this set up for you ?
Thanks,
Liam
V
Vincent Themereau
said
about 2 years ago
Hello,
Thank you for your response.
I can access the data from the Steam community in xml format. For example: http://steamcommunity.com/stats/384330/leaderboards/1203745/?xml=1. But I can reformat the leaderboard data in json first and then upload the json file. (It may be easier).
1/ How do I get authorized?
2/ If I use the secret 'server-send', and connect using the node.js to the correct url, am I in the authorized state?
3/ Basicaly, how can I use these credentials?
Cheers,
Vincent
V
Vincent Themereau
said
about 2 years ago
Hello,
Any news on this?
Thanks
Vincent
Customer Support
said
about 2 years ago
Answer
Hi Vincent,
Apologies for the delayed response. How many players in total do you need to do this for ? You can read about Security Credentials here and how to use them here. In this case I think a BatchAdminRequest or ScheduleBulkJobAdminRequest would be the best way to achieve this. You can read more about how to execute a bulk job here. So if you export the Steam Leaderboard data and then upload it to a GameSparks collection in Json format you could have an event or script that will search for the matching SteamId and then post it to the GameSparks Leaderboard. While using a BatchAdminRequest you would supply the playerIds (up to 500 at a time) of the players who have scores you like to re post, you would supply an event that you want to run against each player in Json format, check below for an example.
//request sent from Test Harness
{
"@class": ".BatchAdminRequest",
"playerIds": [
"570b686ef528a1ccf49e8a6b","570d48a8f528a1ccf49e9f25","570e1319808eb904a5e33677" //etc....
],
"request": {
"@class": ".LogEventRequest",
"eventKey": "repostScores"
}
}
In Cloud Code for the event supplied in this BatchAdminRequest you could do use "var extIds = Spark.getPlayer().getExternalIds();" and check if the players steam ID is located in the collection of Steam scores you uploaded. If it is, then use a SparkRequest to post it to the GameSparks Leaderboard. Using a ScheduleBulkJobAdminRequest would work in a similar way only it would run a supplied script on players that match the query in the request. Here you could check the player collection and if a player has a steamId then check if they have an entry in the steam leaderboard collection you uploaded, if they do, post the score found there for them. To send either of these requests form the Test Harness you need to enable them in "debug" in the credentials window in integrations. If you navigate to there in the portal and click edit on "debug" you can click on the admin tab and enable the admin requests you require. These can now be sent from the Test Harness as a game admin user, you don't need to authenticate as a player to do this.
Let me know if this helps, if you need any further assistance just let us know.
Vincent Themereau
Hello,
I just switched from Steam leaderboard to GameSparks leaderboard and I want to import the Steam leaderboard data to GameSparks collections.
I though I could use cloud code and the function Spark.sendRequestAs. My question is in what kind of cloud code can I use this function ? Currently, I have created a custom event and hooked the following script to it:
{
"@class": ".LogEventResponse",
"scriptData": {
"response": "{\"@class\":\".LogEventResponse\",\"error\":{\"authentication\":\"NOTAUTHORIZED\"}}"
}
}
{
"@class": ".LogEventRequest",
"eventKey": "SCORE_IMPORT_EVT",
"SCORE_VAL": 43840,
"PARTITION_VAL": "16901",
"RACETYPE_VAL": "TimeAttack",
"GAMEMODE_VAL": "RaceOfTheDay",
"PLAYERID_VAL": "56e3f25616e2400499081f37"
}
statementCount: 2
{
"@class": ".AuthenticationResponse",
"authToken": "bee79297-4f06-4753-9be6-afe78fe99cc7",
"displayName": "p1",
"newPlayer": false,
"scriptData": {
"Version": "0.13.52"
},
"userId": "565d79bbe4b005773d6d2903"
}
{
"@class": ".AuthenticationRequest",
"password": "p1",
"userName": "p1"
}
I also tried the same thing but directly connecting from the nodejs sdk (found here:https://bitbucket.org/gamesparks/gamesparks-node-server-sdk) but this time without player authentication (I'm using the server url with the server secret from credentials panel). In this case, I'm directly sending the with the correct playerid, but again I have authentication issue.
WebSocket onMessage: {"@class": ".AuthenticatedConnectResponse","connectUrl": "wss://gsp-aeu001-se14.gamesparks.net/ws/server-send/295146vW8Eww","requestId": "0"}
WebSocket onOpen: Connected
WebSocket onMessage: {"@class":".AuthenticatedConnectResponse","nonce":"fe61a97a-d134-4384-8d99-e5ec985852e0","requestId":"0"}
WebSocket onMessage: {"@class":".AuthenticatedConnectResponse","requestId":"0","sessionId":"fe61a97a-d134-4384-8d99-e5ec985852e0"}
here
create callback
VERBOSE pool gamesparks - timeout: 1460366989218
INFO pool gamesparks - dispense() clients=0 available=1
VERBOSE pool gamesparks - availableObjects.length=1
VERBOSE pool gamesparks - availableObjects.length=1
INFO pool gamesparks - dispense() clients=1 available=1
VERBOSE pool gamesparks - dispense() - reusing obj
I am ready
WebSocket send: {"eventKey":"SCORE_EVT","DATA_VAL":"5704dde32c3d6104a4b57d4e:demo","SCORE_VAL":199,"PARTITION_VAL":"16901","GAMEMODE_VAL":"RaceOfTheDay","RACETYPE_VAL":"TimeAttack","playerId":"5704dde32c3d6104a4b5
7d4e","@class":".LogEventRequest","requestId":"1460366961574_1"}
WebSocket onMessage: {"@class":".LogEventResponse","error":{"authentication":"NOTAUTHORIZED"},"requestId":"1460366961574_1"}
{"@class":".LogEventResponse","error":{"authentication":"NOTAUTHORIZED"},"requestId":"1460366961574_1"}
I found very little documentation about the function Spark.sendRequestAs and about the credentials parameters for integrating with other server. Any idea how I can achieve this ?
Thanks for your help
Hi Vincent,
Apologies for the delayed response. How many players in total do you need to do this for ? You can read about Security Credentials here and how to use them here. In this case I think a BatchAdminRequest or ScheduleBulkJobAdminRequest would be the best way to achieve this. You can read more about how to execute a bulk job here. So if you export the Steam Leaderboard data and then upload it to a GameSparks collection in Json format you could have an event or script that will search for the matching SteamId and then post it to the GameSparks Leaderboard. While using a BatchAdminRequest you would supply the playerIds (up to 500 at a time) of the players who have scores you like to re post, you would supply an event that you want to run against each player in Json format, check below for an example.
In Cloud Code for the event supplied in this BatchAdminRequest you could do use "var extIds = Spark.getPlayer().getExternalIds();" and check if the players steam ID is located in the collection of Steam scores you uploaded. If it is, then use a SparkRequest to post it to the GameSparks Leaderboard. Using a ScheduleBulkJobAdminRequest would work in a similar way only it would run a supplied script on players that match the query in the request. Here you could check the player collection and if a player has a steamId then check if they have an entry in the steam leaderboard collection you uploaded, if they do, post the score found there for them. To send either of these requests form the Test Harness you need to enable them in "debug" in the credentials window in integrations. If you navigate to there in the portal and click edit on "debug" you can click on the admin tab and enable the admin requests you require. These can now be sent from the Test Harness as a game admin user, you don't need to authenticate as a player to do this.
Let me know if this helps, if you need any further assistance just let us know.
Thanks,
Liam
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstCustomer Support
Hi Vincent,
You won't be able to send any data to GameSparks if you are not authorized. Can you give us some samples of the Steam Leaderboard data so we can look into the best way to get this set up for you ?
Thanks,
Liam
Vincent Themereau
Hello,
Thank you for your response.
I can access the data from the Steam community in xml format. For example: http://steamcommunity.com/stats/384330/leaderboards/1203745/?xml=1. But I can reformat the leaderboard data in json first and then upload the json file. (It may be easier).
1/ How do I get authorized?
2/ If I use the secret 'server-send', and connect using the node.js to the correct url, am I in the authorized state?
3/ Basicaly, how can I use these credentials?
Cheers,
Vincent
Vincent Themereau
Hello,
Any news on this?
Thanks
Vincent
Customer Support
Hi Vincent,
Apologies for the delayed response. How many players in total do you need to do this for ? You can read about Security Credentials here and how to use them here. In this case I think a BatchAdminRequest or ScheduleBulkJobAdminRequest would be the best way to achieve this. You can read more about how to execute a bulk job here. So if you export the Steam Leaderboard data and then upload it to a GameSparks collection in Json format you could have an event or script that will search for the matching SteamId and then post it to the GameSparks Leaderboard. While using a BatchAdminRequest you would supply the playerIds (up to 500 at a time) of the players who have scores you like to re post, you would supply an event that you want to run against each player in Json format, check below for an example.
In Cloud Code for the event supplied in this BatchAdminRequest you could do use "var extIds = Spark.getPlayer().getExternalIds();" and check if the players steam ID is located in the collection of Steam scores you uploaded. If it is, then use a SparkRequest to post it to the GameSparks Leaderboard. Using a ScheduleBulkJobAdminRequest would work in a similar way only it would run a supplied script on players that match the query in the request. Here you could check the player collection and if a player has a steamId then check if they have an entry in the steam leaderboard collection you uploaded, if they do, post the score found there for them. To send either of these requests form the Test Harness you need to enable them in "debug" in the credentials window in integrations. If you navigate to there in the portal and click edit on "debug" you can click on the admin tab and enable the admin requests you require. These can now be sent from the Test Harness as a game admin user, you don't need to authenticate as a player to do this.
Let me know if this helps, if you need any further assistance just let us know.
Thanks,
Liam
-
Documentation Notes
-
Design issues with user events
-
Using NoSQL
-
Runtime Collections vs Metadata Collections
-
Anonymous authentication from browser app
-
Modules
-
Movement With Unity
-
Problem with url parameters for downloadables
-
Querying NoSql GameSparks database
-
Challenge accesType
See all 2032 topics