question

John Peterson avatar image
John Peterson asked

Invoke Admin API from Server.

Dear PlayFab community,

Are there any examples of invoking Admin API from the server? I ask, because I want to get some Leaderboard metadata from the Admin.GetPlayerStatisticDefinitions function from my CloudScript endpoint.

I'm not wholly certain, however, how to invoke Admin calls from the server.

Any help would be much appreciated! Thanks in advance!

CloudScriptLeaderboards and Statistics
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

The Admin API is not designed to be used from Cloud Script. However, you can call it from a custom game server, exactly as you do any Server API method. Just be very careful about usage - the Admin API is meant to be used for tools and general game configuration. If it's being called at a higher rate, due to servicing player calls, that would result in hitting the API rate limit.

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.

John Peterson avatar image John Peterson commented ·

Thanks, @Brendan! I had thought about caching the data on my CloudScript servers to mitigate the calls. Do you have a quick example of how to invoke the Admin API from the server, perchance?

0 Likes 0 ·
brendan avatar image brendan John Peterson commented ·

It's literally exactly the same as using the Server API - they both use the SecretKey as the auth header, so all you have to do is copy/paste the way you make the Server API calls.

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.