What is correct PATCH request structure to update a specific attributevalue of an organisationUnit

Hi Community,
What is the correct PATCH request structure to update a specific attributevalue of an organisationUnit via the ../api/organisationUnits/{id} endpoint?
(I want to update only specifc attributevalue (Custom Attribute) rest should stay “as it is” in metadata.(instead of full PUT Request))
Version 2.40.6
Partial Updates.
Any working examples would be appreciated!

Hi @arslan_mughal

Could you please share the JSON that includes your custom attribute?

For this case you will use PATCH /api/organisationUnits/{id} as you explained and the payload patch will be (based on the https://jsonpatch.com/ instructions)

[
  { "op": "replace", "path": "pathtothecustomattribute", "value": "newValue" }
]

Payload:
json

[
  {
    "op": "replace",
    "path": "/attributeValues/attribute/id/qyY5ZVWvpBr/value",
    "value": "newCode123"
  }
]

I also tried:

[
  {
    "op": "replace",
    "path": "/attributeValues/qyY5ZVWvpBr/value",
    "value": "newCode123"
  }
]

But got the error:
Payload cannot contain objects or arrays. ErrorCode: E1003
Also tried without [ ] square brackets and response is 1 but value not updated.
with PATCH ../api/organisationUnits/{id}

Error Response is :

{
    "httpStatus": "Bad Request",
    "httpStatusCode": 400,
    "status": "ERROR",
    "message": "Payload can not contain objects or arrays.",
    "errorCode": "E1003"
}