question

games avatar image
games asked

Can Cloud Code Access the Admin API

Hi,

I'd like to reset leaderboards daily, but not at 00:00 UTC. Instead, I'd like to set it using my own time zone.

What I think I should do is schedule a task, and in cloud code (using handler), somehow access the admin API to call IncrementPlayerStatisticVersion.

Can it be done this way? If yes, how do I access the admin API in Cloud Code? Just like server.DoSomething(), is it admin.IncrementPlayerStatisticVersion(...) ?

I also read a post recommendation where I'm to use an Admin tool to accomplish something like this, and if I'm not mistaken, that means client side on say Unity Editor Extensions right? I'd like this to be automated and purely server side.

Thanks yo!

-Dave

apisCloudScriptLeaderboards and Statisticstasksscheduled tasks
10 |1200

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

1 Answer

·
brendan avatar image
brendan answered

No, Cloud Script has access to the Server API, but not Admin. To reset a statistic on a different time, you would need to write a script which you run locally at the correct time. We'll be providing more options for ways to control the time of a statistic reset in a future update.

2 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.

colinchiu avatar image colinchiu commented ·

Im guessing playfabs back end is a load of cron tasks to reset the board every hour, day, week or month. It would be good if we can override it with our own cron expression.

0 Likes 0 ·
brendan avatar image brendan colinchiu commented ·

Actually, no, that's not how it's set up. But as I said, yes, we will be offering more options for leaderboard resets in a future update. Sorry we can't provide a specific timeframe for this yet - as a live service, we have to ensure that the stability and reliability of the service is our highest priority, so our schedule can (and does) change frequently.

0 Likes 0 ·

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.