FusionAuth
    • Home
    • Categories
    • Recent
    • Popular
    • Pricing
    • Contact us
    • Docs
    • Login

    User registration patch merge behavior

    Scheduled Pinned Locked Moved
    Q&A
    2
    4
    1.1k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T
      trevorr
      last edited by

      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-registration

      The 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.

      1 Reply Last reply Reply Quote 0
      • danD
        dan
        last edited by

        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 I PATCHed 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.

        --
        FusionAuth - Auth for devs, built by devs.
        https://fusionauth.io

        1 Reply Last reply Reply Quote 0
        • danD
          dan
          last edited by

          Here's the bug report: https://github.com/FusionAuth/fusionauth-issues/issues/667

          --
          FusionAuth - Auth for devs, built by devs.
          https://fusionauth.io

          T 1 Reply Last reply Reply Quote 0
          • T
            trevorr @dan
            last edited by

            @dan Thanks so much for the followup! For now, I'll work around the issue with a read/merge/write on the client.

            1 Reply Last reply Reply Quote 1
            • First post
              Last post