question

Cesar avatar image
Cesar asked

Economy v2 admin operations in Unity

Hi,

I would like to do admin operations in the Unity editor that affect the Catalog V2. For example: creating multiple catalog items, grant items to users in bulk etc. I'm afraid I don't know how to do that. I think I have to log in as a "Title Entity" so the numbers of api calls are not restricted by users policy, but I don't know how. The PlayfabAdminApi seems to be only for the old system. How I should proceed?

Thanks in advance,

In-Game Economy
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

·
Simon Cui avatar image
Simon Cui answered

Before using Admin API, please make sure your secret key is set correctly in unity and not being exposed to public.

If you are using PlayFabEditorExtension, you can simply enable Admin API like the screenshot shown below:

5703-i1.png

You can open PlayFabEditorExtension through unity tab [window] -> [PlayFab] -> [Editor Extensions].

If you are not using PlayFabEditorExtension, you need to manually set “ENABLE_PLAYFABADMIN_API” through unity tab [Edit] -> [Project Settings] -> [Player] -> [Other settings] -> [Script compilation], as shown below: 5699-i2.png


i1.png (64.9 KiB)
i2.png (96.1 KiB)
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.

Cesar avatar image Cesar commented ·

Thx Simon, but that was not enough. In any case for being able to do operation as admin in Economy v2, you have fist to get the "title entity token" . For that you have to call GetEntityToken passing as EntityKey: GetEntityTokenRequest request = new GetEntityTokenRequest() { Entity = new PlayFab.AuthenticationModels.EntityKey() { Type = "title", Id = "XXXXX" } }; The whatever operation you do will be form the Title entity.

0 Likes 0 ·
Simon Cui avatar image Simon Cui Cesar commented ·

Yes, it is the right way to call GetEntityToken API of "title" before calling Economy V2 API. Please let us know if you have further questions.

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.