Sync customers
The sync customers API is a single API endpoint that you can use to send customer data into TRAEDE.
Creating vs updating customers
TRAEDE will use customer number to determine if a customer already exists and we are trying to create a new customer or updating an existing one.
For instance, if you send a customer with customer number 1000
TRAEDE will look for an existing one. If one exists this customer will be used. If one does not exist it will be created.
Updating customer numbers of existing customers
Due to the above sync model you are not able to update customer numbers using the customer sync API. This is because if you pass a new customer number, then it will be used to create a new customer instead of updating the one you are trying to update.
Deleting customers
You can delete customers by passing along delete: true
to the customer data. Note that customers with production orders and other data cannot be deleted. TRAEDE will return an error response if the delete was unsuccessful for any reason
POST /customers/sync
Endpoint: POST /customers/sync
Parameter | Required | Default | Description |
---|---|---|---|
customers.* | Yes | An array of customers to update |
Suppliers
Parameter | Data type | Required | Default | Description |
---|---|---|---|---|
customer_number | string | Yes | The item number of the customer. We use this to determine if a customer already exists and we are updating it or we are creating a new one | |
name | string | If new customer | The name of the customer | |
currency | string | If new customer | What is the currency of the customer | |
discount_percentage | float | What discount percentage should the customer have. Should be a number between 0 and 100 | ||
active | boolean | true | Should this customer be active for selling? | |
payment_terms | Payment term | Which payment terms should the customer have | ||
addresses_sync_mode | string | If addresses key exists | Should either be replace to replace existing addresses, or append to append to existing addresses | |
addresses_sync_key | string | If addresses key exists | Should either be address_title or remote_erp_id . This will determine whether to use title field or remote_erp_id field to determine if you are creating a new address or updating an existing one | |
addresses | Array<Address> | Addresses of the customer |
Payment term
Parameter | Required | Default | Description |
---|---|---|---|
payment_terms_id | Yes, if no payment_term_code is supplied | ||
payment_terms_code | Yes, if no payment_term_id is supplied |
Addresses
Parameter | Data type | Required | Default | Description |
---|---|---|---|---|
title | string | Yes | The title of the address. This is for internal use, so you know the difference between addresses. In TRAEDE we use Primary address for invoice address, and Shipping address for delivery address. But you can use whatever you want | |
name | string | Yes | This is the name of the receiver on the address. So this is the "top line" in the address. For B2B customers this is typically the name of the company, and for B2C customers this is typically the name of the receiver | |
address | string | Yes | This the the address line | |
address_2 | string | An optional extra line for the address | ||
zip | string | Yes | Zip code | |
city | string | Yes | City | |
region | string | State, region, etc | ||
country | string | Yes | Country code must be a 2-letter code like DK, US, GB |
Example
POST /production/customers/sync
{
"customers": [
{
"customer_number": "1000",
"name": "A customer",
"currency": "USD",
"payment_term": {
"payment_term_code": "30-days"
}
}
]
}