question

kaushikbhatt avatar image
kaushikbhatt asked

Would it be possible to search all PlayFab users data using CloudScript?

HI,

This question is w.r.t Referrals. We would like our Referral code to be shorter than the PlayFabId (ideally 6 digit/alphanumeric) but the question is how?

We do not have like a central place to do the mapping of unique ID's to PlayFabID's so other option which is very crude and brute force is to go through all users and check for the unique code in their player data.

That's our least preferred option so does anyone have any better option?

Another option could be to run another service outside PlayFab to keep the mapping but that means we also need to keep that list updated as new players come into the game.

Any/All help is appreciated.

Player DataCloudScript
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image
brendan answered

So first, no, it is not possible to iterate through all players as a result of a player action. That would mean each player could be trying to make upwards of millions of API calls, which clearly would not be supportable.

The real question is, what is it you want to do with the referral codes? Are you trying to create a system where you can reward a player for getting someone else to join the game? If so, I would recommend having a look at this sample, which is exactly that:

https://github.com/PlayFab/PlayFab-Samples/tree/master/Recipes/ReferralCodes

Otherwise, could you explain in more detail specifically what the feature is that you're trying to enable, so that we can advise you on the best approach?

4 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

kaushikbhatt avatar image kaushikbhatt commented ·

Hi.. Yes Agreed the option to go thru all players is really Bad.

Yes we have used the same recipe code. What we need now is to reduce the PlayFabId length for the user to punch in to claim the Reward for referral.

0 Likes 0 ·
brendan avatar image brendan kaushikbhatt commented ·

Well, one possibility would be to use the Generic ID system. That was designed for developers to add a lookup for player accounts based upon any arbitrary ID (LinkedIn was the one requested when we added it). So you could add a Generic ID to each player using your code. That would allow you to use the lookup for Generic ID to find the PlayFab ID of the referring user.

0 Likes 0 ·
kaushikbhatt avatar image kaushikbhatt brendan commented ·

Awesome. I thot so when I saw GetPlayFabID from Facebook ID; but didn't spot any API that allowed to get PlayFabId from Generic/CustomID.. Can you point me to that API for Cloudscript?

0 Likes 0 ·
Show more comments
Seth Du avatar image
Seth Du answered

For the custom coupon, we suggest you to consider about converting your title into paid tier then open a ticket to consult devrel@playfab.com. We do not provide short digit coupon generating for Essential Tier. I will @Brendan to see if he can help you with it.

A feasible solution for your issue is firstly, using coupon codes that PlayFab generates to create a shorter one, then mapping them via a database.

For more details about coupon usages, please see the discussions here. If you want to generate a large quantity of coupons codes, you still need to open a ticket with us at devrel@playfab.com

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

kaushikbhatt avatar image
kaushikbhatt answered

Hi SethDu,

I'm not referring to Coupons here I want to know this in relation to Referral Code recipe shown here:

https://github.com/PlayFab/PlayFab-Samples/tree/master/Recipes/ReferralCodes

In this example you guys have used PlayFabID as the referral code which is of length 16; this is cumbersome for users to type when they are just starting to play the game; hence we would like to check if there is a way to shorten this ID.

Cheers!

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.