Jump to content

 

james@foodmesh.ca

Member Since 28 Jan 2017
Offline Last Active May 15 2017 09:47 PM
-----

Topics I've Started

How To Update Select Box Values For Custom Fields Use Rest Api

28 January 2017 - 03:43 AM

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)

supplier_type: [Select Box] (Values: Farmer, Processor, Retailer, Wholesaler, Distributor)

 

I'm trying to figure out how to set these values using the User API. Here's what I've tried:

 

user_id=18:
{
    "consumer_type": "Consumer",
    "supplier_type": "Farmer"
}
 
I get a success response, but the field values don't get updated when I view via the admin panel. I've also tried using the field IDs:
 
user_id=18:
consumer_type: field_id=36:
supplier_type: field_id=37:
 
{
    "fields": {
        "36": "Consumer",
        "37": "Farmer"
    }
}
 
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?

 

Thanks,

James