With the UserRestriction API, when attempting to update only the reason for a restriction to an experience with just the field you want to update, it will make the entire restriction inactive. From my understanding, this is where the updateMask
query parameter comes into play.
Reading the documentation for how it functions, for example if I want to update the displayReason
for a restriction, I would need to provide gameJoinRestriction.displayReason
in the updateMask
query parameter. The expected behavior is the displayReason
being updated, however it instead throws this error:
{
"code": "INVALID_ARGUMENT",
"message": "Invalid field name(s) - gameJoinRestriction.displayReason."
}
Attempting to provide only displayReason
will throw this error:
{
"code": "INVALID_ARGUMENT",
"message": "displayReason is invalid. The field must exist on the UserRestriction resource."
}
This is obviously due to how the displayReason
is provided, which is inside of another object, so clearly this wouldn’t work.
I’ve pretty much exhausted all potential issues, this seems like a bug with the API and not something on my end. Here is some example JavaScript code that will reproduce the first error.
const gameJoinRestriction = {
displayReason: "You have been caught breaking game rules."
}
const url = new URL(`/cloud/v2/universes/3666294218/user-restrictions/36347722`, 'https://apis.roblox.com');
url.searchParams.set('updateMask', 'gameJoinRestriction.displayReason');
const request = await fetch(url, {
method: 'PATCH',
headers: {
"content-type": "application/json",
"x-api-key": 'API-KEY-HERE'
},
body: JSON.stringify({ gameJoinRestriction })
});
const data = await request.json();
console.log(data);
Expected behavior
Updating the restriction should modify the displayReason, not provide an error, and only modify the displayReason.