How do I update an XProfile “checkbox” type group field via BP API?
-
Hello,
I’m working on a mobile app to interface with our BuddyPress 9.0.0 website via the BP API. Our website has some xprofile group fields of the “checkbox” type, each group with a set of “options” which the user can set to be true or false. For example, there is a group called “Pets” under which the user can select one or more of the specified check boxes such as “Dog”, “Cat”, “Cow”, etc.
I am having trouble trying to update this type of “checkbox” field using Postman. The update works fine for fields of type “textbox” and “selectbox”, but doesn’t work for the “checkbox” type.
The endpoint is “/buddypress/v1/xprofile/<field_id>/data/<user_id>” (POST operation, here the field_id I am using is the id of the parent group field)
The JSON in the body of my call is
{ “context” : “edit”, “value”: [“Dog”, “Cat”]}As mentioned before, if I try the same post call with a field of type “textbox” or “selectbox”, it works fine, but if I post to a “checkbox” field it just clears the existing data and does not set it to the new values.
Any ideas what I may be doing wrong here?
- You must be logged in to reply to this topic.