User registration patch merge behavior
-
I'm trying to update
registration.data
using PATCH against FA 1.15.8 according to this documentation: https://fusionauth.io/docs/v1/tech/apis/registrations#update-a-user-registrationThe data is being updated, but the other optional fields that I didn't specify in the PATCH seem to be getting cleared. For example, I had originally set roles and timezone in the FA UI, but these were empty after the PATCH. Does PATCH merge the given
registration
object with the existing one? It seems like it should, since all but one property of this API is in that object, and PATCH wouldn't otherwise be useful. -
Yes,
PATCH
should merge the registration object. It shouldn't clear unpassed values. I tried this out with the below curl command (against v1.16.1) and found that the locale was indeed cleared when IPATCH
ed a registration.curl -vvvv -XPATCH -H "Content-type: application/json" -H "Authorization: $API_KEY" 'http://localhost:9011/api/user/registration/124df3fa-2148-49b2-aa9f-d946e6125174' -d '{"registration" : { "applicationId" : "0ef466ba-0505-4150-9b34-da0895a98cae", "data" : {"test" : "data2"} } }'
I think you found a bug. I'll file a bug report.
-
Here's the bug report: https://github.com/FusionAuth/fusionauth-issues/issues/667
-
@dan Thanks so much for the followup! For now, I'll work around the issue with a read/merge/write on the client.