Is it possible to somehow limit the amount of uploads a user can do, server-side? Say, each user can upload 10 levels/content maximum. And then they can delete their existing content if they wish to free up more space.
This can of course be handled client side no problem, but I also want to perhaps return 400 Bad Request from the server if they’ve reached their max limit.
Can this be done via WebHooks? Or do I need to write my own API around it?
Hi @SorneBachse ,
You can use the search player content which returns the content count and add filters as you see fit.
There is also an obsolete variable still usable: PlayerContentCount
But it’s up to you to develop how you want to manage this.
Let me know if you have questions.
Oooh neat! So I’ll be able to query the backend before uploading to check if the player has reached the maximum amount of uploads? Great, that’s just what I need, thanks !
EDIT:
In case anyone else was wondering, the endpoint returns ALL content ever uploaded by the player including deleted content. In order to only get all the non-deleted content you can add the following filter:
var result = await UgcService.Instance.GetPlayerContentsAsync(new GetPlayerContentsArgs
{
IncludeTotal = true,
Filters = new List<string>
{
// syntax: {field},{operator},{value}
// source: https://services.docs.unity.com/user-generated-content-client/v1/#tag/Content/operation/SearchPlayerContent
"deletedAt,eq,null",
},
});