Customers

The customers have to be defined along with the pricelist_id and vat_group_id. A customer needs to be created first, and then the send_new_password can be used in order to send the password to the customer. Related to customers are also the “addressbooks”, but no separate call is required if the customer has only one address.

Description List Customers
Action GET
URL <your URL here>/api/customers
Sample request parameters {"email_eq":"demo+customer@b2bwave.com"}
Sample Successful Response
[{"customer":{"id":4603,"email":"demo+customer@b2bwave.com","created_at":"2016-09-12T08:08:08.000Z","updated_at":"2016-09-12T08:08:08.000Z","approved":true,"company_name":"Demo Customer Ltd","name":"John Smith","company_activities":"Distributor","pricelist_id":1,"is_active":true,"disable_ordering":false,"phone":"0123456789","comments_admin":null,"vat_group_id":1,"company_activity_id":0,"discount_percentage":"0.0","reference_code":null,"sales_rep_id":null,"sales_rep_commission":"0.0","minimum_order_value":"0.0","address":"945 5th Avenue","city":"New York","province":"NY","country":"US","postal_code":"10021","website":null,"tax_id":"0123456789","tax_office":null,"phone2":null,"fax":null,"invoice_same":true,"invoice_phone":null,"invoice_address":null,"invoice_city":null,"invoice_province":null,"invoice_country":null,"invoice_tax_id":null,"invoice_tax_office":null,"invoice_postal_code":null,"company_number":"XYZ123","extra_fields":{},"address2":null,"invoice_address2":null,"email_new_orders_attach_xls":false, "enable_product_feed":false, "enable_api":false, "enable_orders_import":false, "receive_email_notification":false, "sales_reps": [{"sales_rep_id": 2, "name": "John Jones","email": "test@b2bwave.com"}]}}]
		
Available parameters email_eq, company_name_eq, name_eq, pricelist_id_eq
email_cont, company_name_cont, name_cont
*_eq (equals) fields are for exact match
*_cont (contains) fields are for wildcard match
Description Create Customer
Action POST
URL <your URL here>/api/customers
Sample request parameters
{
   "customer":{
      "email":"demo+customer@b2bwave.com",
      "company_name":"Demo Customer Ltd",
      "phone":"0123456789",
      "name":"John Smith",
      "company_activities":"Distributor",
      "pricelist_id":1,
      "vat_group_id":1,
      "minimum_order_value":0,
      "address":"945 5th Avenue",
      "city":"New York",
      "province":"NY",
      "country":"US",
      "postal_code":"10021",
      "company_number":"XYZ123",
      "tax_id":"0123456789",
      "sales_reps":[{"sales_rep_id":1, "sales_rep_commission":1.0}, {"sales_rep_id":2, "sales_rep_commission":2.0}]
   }
}
		
Sample Successful Response
{"id":4603,"email":"demo+customer@b2bwave.com","created_at":"2016-09-11T16:57:42.054Z","updated_at":"2016-09-11T16:57:42.054Z","approved":true,"company_name":"Demo Customer Ltd","name":"John Smith","company_activities":"Distributor","pricelist_id":1,"is_active":true,"disable_ordering":false,"phone":"0123456789","comments_admin":null,"vat_group_id":1,"company_activity_id":0,"discount_percentage":"0.0","reference_code":null,"sales_rep_id":null,"sales_rep_commission":"0.0","minimum_order_value":"0.0","customer_id":4603,"address":"945 5th Avenue","city":"New York","province":"NY","country":"US","postal_code":"10021","website":null,"tax_id":"0123456789","tax_office":null,"phone2":null,"fax":null,"invoice_same":true,"invoice_phone":null,"invoice_address":null,"invoice_city":null,"invoice_province":null,"invoice_country":null,"invoice_tax_id":null,"invoice_tax_office":null,"invoice_postal_code":null,"company_number":"XYZ123","extra_fields":{},"address2":null,"invoice_address2":null,"email_new_orders_attach_xls":false, "enable_product_feed":false, "enable_api":false, "enable_orders_import":false, "receive_email_notification":false, "sales_reps": [{"sales_rep_id": 2, "name": "John Jones","email": "test@b2bwave.com"}]}
		
Sample Failed Response
{"company_name":["is too short (minimum is 2 characters)"],"name":["is too short (minimum is 2 characters)"],"email":["can't be blank"]}
		
Required fields email, company_name, name, vat_group_id, pricelist_id
Description Update Customer
Action PATCH
URL <your URL here>/api/customers/<customer id>
Sample request parameters
{"customer":{"email":"demo+customer@b2bwave.com","company_name":"Demo Customer Ltd","phone":"0123456789","name":"Jim Smith","company_activities":"Distributor","pricelist_id":1,"vat_group_id":1,"minimum_order_value":0,"address":"945 5th Avenue","city":"New York","province":"NY","country":"US","postal_code":"10021","company_number":"XYZ123","tax_id":"0123456789"}}
		
Sample Successful Response Same as Create
Sample Failed Response Same as Create
Description Send Password to Customer
Action GET
URL /api/customers/<customer id>/send_new_password
Sample request parameters (empty – no data required)
Sample Successful Response The customer was successfully updated.


Field descriptions for Customers

Name Type Description Required
company_name string Company name yes
name string Name of person managing the account yes
email string Login email yes
phone string - no
phone2 string - no
fax string - no
website string - no
company_activities string Description of company activities yes
pricelist_id integer Customer price list id yes
vat_group_id integer Customer VAT group id yes
address string - no
address2 string - no
city string - no
province string - no
country string - no
postal_code string - no
invoice_same boolean Are invoice details same as the previous address details? no – default: false
invoice_phone string - no
invoice_address string - no
invoice_address2 string - no
invoice_city string - no
invoice_province string - no
invoice_country string Two letter ISO code for Country (eg GB, US, CH) no
invoice_tax_id string - no
invoice_tax_office string - no
invoice_postal_code string - no
approved boolean Is customer approved? no – default: true
is_active boolean Is customer active? no – default: true
disable_ordering boolean Prevent customer for placing orders
no - default: false
comments_admin string Free text field for admin no
company_activity_id integer Company activity based on list – not currently supported by API no – default: 0
reference_code string Used by external systems for assigning their id no
sales_rep_id integer Id of sales rep assigned to this customer no
sales_rep_commission decimal Commission for sales rep assigned to this customer – not currently supported by API no
minimum_order_value decimal Customer should place order of total value X or above no – default: 0
discount_percentage decimal Customer discount on order total no – default: 0
extra_fields string Customer registration extra fields as key-value pairs no
email_new_orders_attach_xls boolean Customer receives his placed order as an Excel file by email no – default: false
company_number string Company Number used by most countries no
tax_id string Tax/VAT registration used by EU countries no
tax_office string Tax Office used by some EU countries no
private_product_skus array Array of product codes/SKUs that the customer can have access to
no
created_at datetime Create Time auto calculated
updated_at datetime Update Time auto calculated
enable_product_feed
boolean Enable the customer's product feed no – default: false
enable_api boolean Enable the customer to use the API no – default: false
enable_orders_import boolean Enable the customer to import orders no – default: false
receive_email_notifications boolean Enable the customer to receive invoice and order notifications no – default: false
sales_reps
array
Assign the customer sales reps

no
admin_fields object Assign the customers admin extra fields as key-value pairs no
Description Get customer details by email
Action GET
URL <your URL here>/api/customers/by_email?email=<customer email>
Sample Successful Response Same as Create
Sample Failed Response Same as Create

Still need help? Contact Us Contact Us