So I experimentally banned a player from an experience of mine using the new Ban API, with the intention to unban them right after. However, UnbanAsync() was not doing it. No errors. This player doesn’t even show up on the Ban dashboard of the experience.
I doubt it’s relevant, but let’s say I might’ve even specified the ban duration as 54 years. As a joke. In my defense, I didn’t know this guy would end up permanently stuck in banland!
Per this DevForum thread, it looks like other people have experienced the same problem and have had to resort to hacky calls to the literal under-the-hood API itself, completely outside of Studio. I’ve tried this myself, but my request to that server has been met with the error { "code": "PERMISSION_DENIED", "message": "Resources not authorized." } , so, maybe we were able to make network calls to that endpoint in the past, but that has since been changed?
Well, for one, I expect UnbanAsync() to unban the player, as advertised. And if that’s not doing the trick, then I expected the hacky, under-the-hood API call to do the trick instead. Neither work.
Hey thanks for the reply! The idea with the API call is that I’m overwriting the ridiculous 54 year ban with a shorter ban that will expire faster. Yes, I could set active to false or make the duration shorter to make the man expire even faster, but that’s sort of besides the point.
The problem is that my API call isn’t even going through. It’s being blocked by Roblox, from what I can gather from the error response { "code": "PERMISSION_DENIED", "message": "Resources not authorized." }.
So upon searching for the meaning of this error, I came upon this DevForum thread. Looks like I was using the place id rather than the universe id. Upon obtaining the universe id and reflecting that change in the code, my API call finally went through and I was able to override the ban.
My Python program that made the API call from my Windows terminal:
import requests
prisoner_id = input("Enter the banned user's UserId:\n")
# Credentials and endpoint info
url = f'https://apis.roblox.com/cloud/v2/universes/140047761/user-restrictions/{prisoner_id}'
headers = {
'x-api-key': 'your_api_key_here', # Redacted mine
'Content-Type': 'application/json',
}
payload = {
"gameJoinRestriction": {
"active": True,
"duration": "3000s",
"privateReason": "some private reason",
"displayReason": "some display reason",
"excludeAltAccounts": False
}
}
# Send the PATCH request
response = requests.patch(url, headers=headers, json=payload)
print("Response:")
print(response.text)
print("Operation completed. Press ENTER to close this window.")
input()
Still, it’s crazy that this ban didn’t show up on the Ban dashboard for the experience on the Creator Hub, AND Players:UnbanAsync() outright didn’t work! We shouldn’t have to break out hacky workarounds to reverse accidents like this. Roblox pls fix?