REST API to change configuration of z-wave lock

I am trying to use the RESP API to figure out how to change the user codes in a z-wave lock

This is what the code looks like

UID: zwave:device:8577461f51:node49
label: Z-Wave Node 049 (0090:0811:13A8:7.13)
thingTypeUID: zwave:kwikset_ks620_00_000
configuration:
usercode_code_139: “”
usercode_code_135: “”
usercode_code_136: “”
usercode_code_137: “”
usercode_code_138: “”
long list of user codes and user names

This is what the RESP API screen looks like

I have tried all the permutations I can think of to change
usercode_code_6 to 12345 and I always get a server error response code 500

For example when using
{
“usercode_code_6”: 12345
}

I get

When typing
{“configuration”:{
“usercode_code_6”: 12345}
}

I get

{
  "error": {
    "message": "Invalid type '{com.google.gson.internal.LinkedTreeMap}' of configuration value!",
    "http-code": 500
  }
}

Can anyone tell me how I have to format the request body to change the user code?

Thank you

I don’t have any zwave locks, but is there an usercode_code_6? I’m assuming this

is from a GET?

Anyway one option I use to get the format right is to use the GET /things/thingUID, copy it and paste into a PUT /things/thingUID and carefully edit what I want to change.

The list of user codes is from the code tab of the THING, I don’t know why it is not sorted but there are 250 codes and 250 names in some sort of quasi random listing…

If I understand your reply, you are saying that I have to send the whole configuration, everything that is in the code tab to change 1 or 2 values, I can’t send only the line/s I want to change?

Thank you

I’m just saying I have done that when I have had a problems (like getting the format right) just changing 1 or 2 lines. I’m not an experienced REST API person, so resort to what I know should work. Someone else in the forum may be able to help with just updating the 2 lines.

My other question is whether “6” is one of the 250 options or do they start at 100?

Edit: Also did you just try to change on the code tab?

Thank you.
The list starts at 1 and I have already populated 1-5. For some reason the listing in the code tab is not sorted. If I look at the THING tab, everything is sorted there.
I will play with the GET and PUT statements, I just thought using the REST-API explorer would help me figure out what to do.

After making many changes to the curl command I am down to 1 error but I can’t get past it

This is my curl command

curl -X PUT -H "Content-Type:application/json\" -H "Accept:application/json\" -H "Authorization:Bearer key" -d "{"usercode_code_5":"123456"}" "http://my IP address:8080/rest/things/zwave:device:8577461f51:node51/config"

I get an unauthorized 401 code and in the logs I see a warning in the logs

2023-04-02 18:52:26.781 [WARN ] [ore.io.rest.auth.internal.AuthFilter] - Unauthorized API request from 192.168.0.98: Error while processing JWT token
2023-04-02 18:53:00.645 [WARN ] [ore.io.rest.auth.internal.AuthFilter] - Unauthorized API request from 127.0.0.1: Error while processing JWT token

I am copying the key from the openhab API explorer PUT request

Any ideas on what to test?

Thank you

Not very knowledgeable on this subject, but look at settings–>API----> Advanced tab and then the documentation openHAB REST API | openHAB on how this is supposed to work.