Curious if there is anyway to view/edit a player's privateData key value pairs from the NoSQL viewer. Trying to verify that data is getting correctly formatted and written. I am failing to see anything in the NoSQL explorer relating to privateData.
From Cloud Code:
player.setPrivateData("blah", blah);
Best Answer
C
Customer Support
said
about 7 years ago
Hi Evan,
Yes you could use the the REST API to connect externally, you would just need to authenticate with your Admin username and password in your REST client of choice, you can read more about REST here. You could also use the Callback URL to make HTTP calls into the GameSparks platform and then execute some custom cloud code in the Callback URL system event, this is located in the Cloud Code System menu under Callback URL. You can read more about how to implement that here. It might be easier for you to create a custom collection to store this data in. You could insert a document for each player using the the playerID to name them (this helps for retrieval) and keep all the data you need in there rather than storing in each user's privateData. If you need any more help just let me know.
It's best to use SparkPlayer calls to change any of the details on the player document. You can read more about SparkPlayer here.
The following will set the privateData of the current Authenticated Player in Cloud Code.
var userName = Spark.getPlayer().setPrivateData("name", "value");
You can then use this to get the current players privateData
var userName = Spark.getPlayer().getPrivateData("name");
Removing the privateData of the current user can be achieved with
var userName = Spark.getPlayer().removePrivateData("name");
Thanks,
Liam
E
Evan Gilbert
said
about 7 years ago
So it sounds like there is no way to edit a player's privateData from the NoSQL viewer? Only from inside a player socket connection?
My aim is to mark userData edits in a user's private data allowing them to integrate these changes with their live data via structured calls that check for the existence of these markers. I would use these modifiers to correct userData based complaints, bugs, etc in our game such as added additional coin. So how would I be able to edit a player's private data from outside the player's socket connection?
Along similar lines, is there any way to interact with the server from outside a player socket connection?
Customer Support
said
about 7 years ago
Answer
Hi Evan,
Yes you could use the the REST API to connect externally, you would just need to authenticate with your Admin username and password in your REST client of choice, you can read more about REST here. You could also use the Callback URL to make HTTP calls into the GameSparks platform and then execute some custom cloud code in the Callback URL system event, this is located in the Cloud Code System menu under Callback URL. You can read more about how to implement that here. It might be easier for you to create a custom collection to store this data in. You could insert a document for each player using the the playerID to name them (this helps for retrieval) and keep all the data you need in there rather than storing in each user's privateData. If you need any more help just let me know.
Evan Gilbert
Curious if there is anyway to view/edit a player's privateData key value pairs from the NoSQL viewer. Trying to verify that data is getting correctly formatted and written. I am failing to see anything in the NoSQL explorer relating to privateData.
From Cloud Code:
player.setPrivateData("blah", blah);
Hi Evan,
Yes you could use the the REST API to connect externally, you would just need to authenticate with your Admin username and password in your REST client of choice, you can read more about REST here. You could also use the Callback URL to make HTTP calls into the GameSparks platform and then execute some custom cloud code in the Callback URL system event, this is located in the Cloud Code System menu under Callback URL. You can read more about how to implement that here. It might be easier for you to create a custom collection to store this data in. You could insert a document for each player using the the playerID to name them (this helps for retrieval) and keep all the data you need in there rather than storing in each user's privateData. If you need any more help just let me know.
Thanks,
Liam
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstCustomer Support
Hi Evan,
It's best to use SparkPlayer calls to change any of the details on the player document. You can read more about SparkPlayer here.
The following will set the privateData of the current Authenticated Player in Cloud Code.
You can then use this to get the current players privateData
Removing the privateData of the current user can be achieved with
Thanks,
Liam
Evan Gilbert
So it sounds like there is no way to edit a player's privateData from the NoSQL viewer? Only from inside a player socket connection?
My aim is to mark userData edits in a user's private data allowing them to integrate these changes with their live data via structured calls that check for the existence of these markers. I would use these modifiers to correct userData based complaints, bugs, etc in our game such as added additional coin. So how would I be able to edit a player's private data from outside the player's socket connection?
Along similar lines, is there any way to interact with the server from outside a player socket connection?
Customer Support
Hi Evan,
Yes you could use the the REST API to connect externally, you would just need to authenticate with your Admin username and password in your REST client of choice, you can read more about REST here. You could also use the Callback URL to make HTTP calls into the GameSparks platform and then execute some custom cloud code in the Callback URL system event, this is located in the Cloud Code System menu under Callback URL. You can read more about how to implement that here. It might be easier for you to create a custom collection to store this data in. You could insert a document for each player using the the playerID to name them (this helps for retrieval) and keep all the data you need in there rather than storing in each user's privateData. If you need any more help just let me 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 2487 topics