Patch people Custom attribute value

I have a custom Yes/No attribute created for the User profile. By default attribute do not have any value and attribute is not shown in API response when it is null. 

I am trying to replace the custom attribute value using the following api.

https://rollins.teamdynamix.com/TDWebApi/api/people/{uid}

And I am using the below object as a body but getting error. Could someone help me solve this issue?

{

    "op": "replace", 

    "path": "/attributes/3426", 

    "value": {

        "Value": "4310",

        "ValueText": "Yes",

        "ChoicesText": "Yes"

    }

}

 

Here is the Response:

{

    "ID": -1,

    "Message": "patch must not be null. Errors:\r\n* Exception Message: The JsonPatchDocument was malformed and could not be parsed."

}

Asked by Rakesh Gunnam on Mon 7/8/24 1:49 PM
Sign In to leave feedback or contribute an answer

Answer (1)

This answer has been marked as the accepted answer
Mark Sayers Mon 7/8/24 1:54 PM

Hello Rakesh,

A PATCH call is an array of objects that specify particular operations to perform against one or more properties about (in this case) a ticket object.

Your syntax would appear to be inaccurate. If the goal is to set that attribute to use the choice with the ID of 4310, the syntax for the call's body should be as follows:

[ {"op": "replace", "path": "/attributes/3426", "value": "4310"} ]

Sincerely,
Mark Sayers
Sr Support Consultant, CS

No feedback
Also be sure your API URL for the call is accurate according to your organization's TDX domain. - Mark Sayers Mon 7/8/24 1:56 PM
Thanks, Mark! It worked for me but with a small change.
[ {"op": "replace", "path": "/attributes/3426", "value": 4310} ]

it worked after making the value an integer instead of a string.

Thank you for all your help.
Rakesh
- Rakesh Gunnam Mon 7/8/24 5:32 PM