Feature No Code Attached Yet Webservices
avatar aftertaf
aftertaf
15 Jul 2022

Steps to reproduce the issue

send a PATCH API call to the {{base_url}}/{{base_path}}/users/{{user_id}} API
Contents:
{"email":"testing@somemail.com", "some_custom_field": "0"}

Expected result

for the user specified by the {user_id}, the mail and custom field get updated to the values sent in the API call

Actual result

HTTP 500 Internal Server Error : "Save failed with the following error: You can't save a user account without selecting at least one user group."

System information (as much as possible)

PHP 8.0.18
Joomla 4.1.5 + 4.2.0-beta4-dev

Additional comments

When doing an API PATCH call to the USERS API (my use-case would be to update a custom field for the user), I cannot do the API call without specifying the "groups":["1","2","3" (etc)] array.
I don't want to updade the user groups nor to have to first GET all the USER groups in order to post them back unchanged...

Votes

# of Users Experiencing Issue
1/1
Average Importance Score
4.00

avatar aftertaf aftertaf - open - 15 Jul 2022
avatar aftertaf aftertaf - change - 15 Jul 2022
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 15 Jul 2022
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 15 Jul 2022
avatar alikon alikon - change - 15 Jul 2022
Labels Added: ?
avatar alikon alikon - labeled - 15 Jul 2022
avatar alikon
alikon - comment - 15 Jul 2022

didn't checked yet...
did it happen even without custom fields ?

avatar alikon alikon - change - 16 Jul 2022
Status New Closed
Closed_Date 0000-00-00 00:00:00 2022-07-16 07:33:27
Closed_By alikon
avatar alikon alikon - close - 16 Jul 2022
avatar alikon
alikon - comment - 16 Jul 2022

please test #38283

avatar aftertaf
aftertaf - comment - 24 Jul 2022

Hi,
I've tried to test but I get a HTTP 500 error, whatever API call I try.
"View not found [name, type, prefix]: tags, html, api"
I think I might have broken something while trying to troubleshoot, but I am at a loss as to what...
Distracted, doing this while looking after kids, didn't note every little thing down.... Classic #fail....
Any idea which file I can check against the source branch and see what stupid thing I did ?
Sorry for being overly lame !

avatar alikon alikon - change - 11 Apr 2024
Status Closed New
Closed_Date 2022-07-16 07:33:27
Closed_By alikon
Labels Added: Webservices
Removed: ?
avatar alikon alikon - reopen - 11 Apr 2024
avatar Hackwar Hackwar - change - 28 Nov 2024
Labels Added: Feature
avatar Hackwar Hackwar - labeled - 28 Nov 2024
avatar farhanalisaleem6-lang
farhanalisaleem6-lang - comment - 23 Oct 2025

This issue occurs because Joomla’s Users API requires at least one user group to be passed when updating a user via a PATCH request. If you don’t include the "groups" field, Joomla attempts to save the user without any groups assigned — which triggers the error:

"Save failed with the following error: You can't save a user account without selecting at least one user group."

Workaround / Solution:
To successfully update user data (like email or custom fields) without changing groups, you can follow one of these approaches:

Include the existing user groups in your PATCH request.

First, perform a GET request to fetch the current user details:

GET {{base_url}}/{{base_path}}/users/{{user_id}}

Copy the "groups" array from the response and include it in your PATCH request:

{
"email": "testing@somemail.com",
"some_custom_field": "0",
"groups": ["2", "8"]
}

Alternatively, create a small plugin or override that modifies Joomla’s Users API behavior — allowing PATCH requests to skip group validation when "groups" is not provided.

Expected Fix (Joomla Core Improvement):
Ideally, Joomla should handle PATCH requests as partial updates, not full replacements, meaning it shouldn’t require unchanged fields (like groups) to be resent. This might be addressed in future Joomla versions.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/38277.
avatar brianteeman
brianteeman - comment - 23 Oct 2025

Please remove the spam

Add a Comment

Login with GitHub to post a comment