I am convinced none of the update APIs work with custom fields. Can someone show me sample code that works with custom fields AND actually updates the backend?
Here is what all I have tried -
First off, I have two fields whitelisted or entered as custom fields with text values in the member/contact area. I copy pasted the names into code to ensure I wasn’t messing up the spelling of the field.
Fetching from both request/responsese from logs -
Attempt 1: old API(users) - as a simple string value
Request :
[{“customFields”:{“DeliveryInstructions”:“abc”}}]
// I added the user ID to the request as well - I am simply showing the core part of the request
Response :
[“server responded with - {"message":"Unexpected value for StringValue","details":{}} (400)”]"
Attempt 2: old API(users) - with value string as object
Request :
[{“customFields”:{“DeliveryInstructions”:{“0”:“a”,“1”:“b”,“2”:“c”,“3”:“s”,“4”:“s”,“5”:“s”}}}]
// I added the user ID to the request as well - I am simply showing the core part of the request
Response :
“[“server responded with - {"message":"Unexpected value for StringValue","details":{}} (400)”]”
Attempt 3: New API(members) - with value as object
Request :
“[{“contactDetails”:{“customFields”:{“DeliveryInstructions”:{“0”:“a”,“1”:“b”,“2”:“c”}}}}]”
// I added the user ID to the request as well - I am simply showing the core part of the request
Note: All XXX/123 are PII which I have hidden.
Here the call succeeds but nothing is actually written to the backend, since 1) it is not returned in the response and 2) is also not available in the contact/member detail via the Wix frontend
Attempt 4: New API (members) - with value as a string
Request:
“[{“contactDetails”:{“customFields”:{“DeliveryInstructions”:“abc”}}}]”
// I added the user ID to the request as well - I am simply showing the core part of the request
Response:
“[“message: Expected an object\ndetails:\n applicationError:\n description: Bad Request\n code: BAD_REQUEST\n data: {}”]”