I'm trying to integrate a legacy system with CS-Cart and I'd like to use the REST API to create new user accounts for a closed marketplace. I've been able to use Postman to create a new user in CS-Cart and set the value of the predefined user profile fields (company, email, phone, etc), but I'm having trouble updating the custom fields I've added via Administration → Profile fields. Here's what I'm trying to do:
Custom Fields
consumer_type: [Select Box] (Values: Consumer, Charity, Non Profit, Social Enterprise, Liquidator)
Same thing - I get a success response, but the field values don't get updated. Can someone please explain how to set the value of a custom field Select Box?
OK, I think I've figured this out. When creating a new Profile field that uses a Select Box you need to enter the selections via the "Variants" tab. Each variant is assigned a sequential ID. In my example, here is how the IDs were assigned:
Custom Fields (id: value)
consumer_type = {
"1": "Consumer",
"2": "Charity",
"3": "Non Profit",
"4": "Social Enterprise",
"5": "Liquidator"
}
supplier_type = {
"6": "Farmer",
"7": "Processor",
"8": "Retailer",
"9": "Wholesaler",
"10": "Distributor"
}
Now that I know how the IDs are assigned it's easy to reference them, however my integration will break if the CS-Cart admin changes anything in the profile forms. For example, if an admin accidentally deletes a variant value and then adds it back with exactly the same value it'll still be assigned a new ID, thereby breaking my integration.
Is there a way to use the API to query for the field values and IDs so that I can make my code robust to changes by the CS-Cart admin?
Can you provide more detail here? I'm trying to accomplish the same thing via the Vendors API and 2 custom fields. I'm getting a 200 response but the fields aren't being added/updated in the database.