Sign In Register

How can we help you today?

Start a new topic

How to get player segment?


Is there a way how to get the segments the player belongs to? I know that it is easily done in Cloud Code but I need to retrieve this on client side using Request API. Is there a way how to get this information? The AccountDetailsRequest does not return this info which is a shame as this info is stored in player system collection together with info about currencies or ScriptData.



You could create an event (e.g. getPlayerSegments) that obtains the segments (via Spark.getPlayer().getPlayerSegments()) in cloud code and returns them in the response. 

Alternatively, you could add some cloud code to one of our in-built responses (e.g. AccountDetailsResponse), that obtains the player's segments and returns them in the response's scriptData. You can add to a response's scriptData using Spark.setScriptData("segments", playerSegments);



Thanks. I know I can make my own cloud script to get this data from server but I thought that it is such essential info that it should be returned in some request API call. It puzzles me why it is omitted from AccountDetailsRequest as it would a perfect fit. Anyway thanks for clarification!

Login to post a comment