Providing updateMask for UserRestriction API does not work

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.

1 Like

Hey @HooferBevelops , this is field mask is meant to apply for patching game_join_restriction as a whole and it doesn’t work for the individual field in game_join_restriction. Sorry for the confusion and thanks for flagging this to us! If you want to update the displayReason, the recommended way is to issue a new restriction/ban to overwrite the existing one.
Let us know if you encounter other issues.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.