question

Iida Yuma avatar image
Iida Yuma asked

Catalog Admins (EconomyV2)

Could you tell me where can I find the specification about Catalog Admins?

I'm currently trying to control catalog item with Unity editor. I was able to use CreateDraftItem, GetDraftItems, UpdateDraftItem, and PublishDraftItem with title entity.

If I can use catalog admin account to call those API from Unity editor, that will be nice since I can remove ENABLE_PLAYFABADMIN_API but some API seems not allow to use. Is this behavior intended? And I want to know how we can use catalog admins. Thank you.

I'll put some result of my test I did below.

Update catalog config like below

"Config": {
            "IsCatalogEnabled": true,
            "AdminEntities": [
                {
                    "Id": "182ED25117AB1C30",
                    "Type": "title_player_account",
                    "TypeString": "title_player_account"
                }
            ],
            "Catalog": {
                "ContentTypes": [
                ],
                "Tags": []
            },
            "DeepLinkFormats": [],
            "DisplayPropertyIndexInfos": [
                {
                    "Name": "Priority",
                    "Type": "QueryDouble"
                }
            ],
            "ReviewerEntities": [],
            "UserGeneratedContent": {
                "ContentTypes": [],
                "Tags": []
            },
            "File": {
                "ContentTypes": [],
                "Tags": []
            },
            "Image": {
                "Tags": []
            },
            "Platforms": [
                "Oculus"
            ]
        }

Then If I tried to call GetDraftItem with assigned admin account with below request,

{
  "Id": "3fb6a078-cd26-4a19-b9fe-b4ff84bcdf50"
}

I got below error

{
    "code": 401,
    "status": "Unauthorized",
    "error": "NotAuthorized",
    "errorCode": 1089,
    "errorMessage": "Calling Entity does not have permissions to the Item Type."
}

But if I use GetDraftItems with assigned admin,

{
  "Ids": [
    "3fb6a078-cd26-4a19-b9fe-b4ff84bcdf50"
  ]
}

I can retrieve item.

{
    "code": 200,
    "status": "OK",
    "data": {
        "Items": [
            {
                "Id": "3fb6a078-cd26-4a19-b9fe-b4ff84bcdf50",
                "Type": "catalogItem",
                "AlternateIds": [
                    {
                        "Type": "FriendlyId",
                        "Value": "ScheduleTest1"
                    }
                ],
                "Title": {
                    "NEUTRAL": "ScheduleTest1"
                },
                "Description": {
                    "NEUTRAL": "This item is for testing scheduling system"
                },
                "Keywords": {},
                "CreatorEntity": {
                    "Id": "87ADE",
                    "Type": "title",
                    "TypeString": "title"
                },
                "IsHidden": true,
                "Platforms": [],
                "Tags": [],
                "CreationDate": "2024-01-29T10:13:15.268Z",
                "LastModifiedDate": "2024-01-29T10:13:15.268Z",
                "StartDate": "2024-01-01T00:00:00Z",
                "Contents": [],
                "Images": [],
                "ItemReferences": [],
                "PriceOptions": {
                    "Prices": [
                        {
                            "UnitAmount": 1,
                            "Amounts": [
                                {
                                    "ItemId": "f7495a45-aade-41e5-8d35-0f4bfbe30a50",
                                    "Amount": 1000
                                }
                            ]
                        }
                    ]
                },
                "DeepLinks": [],
                "DisplayProperties": {},
                "ETag": "\"c6032921-0000-0800-0000-65b77a3b0000\""
            }
        ]
    }
}
apisIn-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.

Neils Shi avatar image
Neils Shi answered

If I use the entity of player which added to the Catalog admins to call the API GetDraftItem, then it only allows me to retrieve the ugc items. Attempting to retrieve other types of items will result in the error message "Calling Entity does not have permissions to the Item Type." But if I call the API GetDraftItems with the Catalog admins entity, then I can retrieve other types of items (e.g. catalog item/currency/bundle), including ugc. So, as a workaround, you may use the API GetDraftItems instead. In addition, as Economy v2 settings overview - PlayFab | Microsoft Learn mentions that "Although Admin Players are given title-level edit, delete, and access privileges, they are still considered players for the purposes of Policies. For example, if the DeleteItem API was disabled for all players, Admins will not be able to delete content (but titles will continue to be able to)", so you may also need to check your Economy v2 policies. And we don't recommend you turn on "ENABLE_PLAYFABADMIN_API", as it can lead to cheating and compromise your game's security.

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.

Iida Yuma avatar image Iida Yuma commented ·

Thank you for replying.

Result of your GetDraftItem API test makes me feel that admin account recognize as a normal title entity.

I didn't know about policy settings, so I'll check that, thank you for pointing this.

Regarding the ENABLE_PLAYFABADMIN_API symbol, yes, that's why I trying to use catalog Admins but right now. I'll not include this symbol in build.

0 Likes 0 ·
kylemc@microsoft.com avatar image
kylemc@microsoft.com answered

That sounds like a bug to me. I think I would expect admin players to be able to use all the management APIs (that you listed above) like they own the item. It's likely we got the logic wrong in the GetDraftItem permissions. I'll take a look.

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.

Iida Yuma avatar image Iida Yuma commented ·

Thank you for your help.

I'll also check policy setting in our title.

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.