question

Koen avatar image
Koen asked

Is it possible to execute Admin API calls via CloudScript?

See question; is it possible to execute Admin API calls via CloudScript?

apisCloudScript
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

Not currently, no. We do plan to provide a way to use the Admin API from scripts which are specifically triggered as title-level Tasks (not against a Segment) in a future update, for purposes of making configuration changes to a game to support things like events. What is it that you want to do specifically, though? We may be able to help you design something suited to your game's needs.

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

Koen avatar image Koen commented ·

Thanks for the answer. We want to be able to reset a specific statistic on specific/scheduled moments (not just daily, weekly or monthly). It's not pratical for us to reset the statistic manually via the GameManager.

0 Likes 0 ·
brendan avatar image brendan Koen commented ·

Then I would recommend using a local script/tool which makes the call to increment the statistic at the correct time. We'll be providing a way to specify the time of a leaderboard reset in a future update.

0 Likes 0 ·
Koen avatar image Koen brendan commented ·

Thanks for the answer. We'll go with that solution.

0 Likes 0 ·
Jason Lust avatar image
Jason Lust answered

"We'll be providing a way to specify the time of a leaderboard reset in a future update."

It's been a long time and I can't find if this future update has happen.

What I did find as a solve:

https://docs.microsoft.com/en-us/gaming/playfab/features/automation/cloudscript/making-webhook-calls-from-cloudscript

You can make URL calls, these URL calls can be the Playfab title Admin endpoints.

Unless I'm missing a huge security issue here, the cloud script can use an api key to call admin endpoints, and most importantly for me, from a scheduled task with a custom Cron time argument.

1 comment
10 |1200

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

Seth Du avatar image Seth Du ♦ commented ·

It is possible to call Admin API by creating HTTP calls in Cloud Script, but it is not suggested. If you write the function properly, even you store api key in Cloud Script, there won't be secure issues because the players can only send requests and get responses. Caller identity information can be verified before any administrative actions are taken (through context function parameter). Please also note that only the administrator can review the cloud script source code.

If using Azure Function, you can store API keys in configuration parameters in Azure portal, which means there won't be API key plain text in your code. To call Admin API, you can define a PlayFab Admin Instance API.

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.