8.3 customer (adding and updating customers)
The customer is looked up by distributorCode and code. If not found, it is added; if found, only the fields sent are updated. The customer code cannot be changed with this method.
| Field | Type | Required | Description |
|---|---|---|---|
distributorCode | text | Yes | Distributor code |
code | text | Yes | Customer code |
name | text | For new customers | Legal name |
shortName | text | For new customers | Short name |
customerType | text | For new customers | Customer type name (same as the name defined in the system) |
creditCode | text | For new customers | Advance = prepaid, Cash = cash, Deferred = on credit terms |
paymentType | text | For new customers | Cash, Credit Card, Bank Transfer, Check, Bond, Open Account |
creditStatus | text | No | Unlimited, Warning, Error |
creditLimit, dueDays | number | No | Credit limit, payment term in days |
mainCustomerCode | text | No | Head office customer it belongs to |
integrationCode, integrationCode2 | text | No | Integration codes |
sellerDistributorCode, sellerCode | text | No | Sales representative of the card |
taxOffice, taxNo, idNo, taxTypeName | text | No | Tax office, tax number, national ID number, tax class |
countryName, cityName, townName | text | No | Address, using the names defined in the system |
address1, address2, postCode | text | No | Address |
workTel1, mobileTel1, email etc. | text | No | Contact details |
gpsCoordX, gpsCoordY | number | No | Longitude, latitude |
passive, dontSell, disabled | true/false | No | Passive, do not sell, disabled |
Values must be written exactly, including case and spaces; an unrecognized value falls back to the default (Cash, Advance, Unlimited). For a new customer, date fields that are not sent take today's date.
{ "distributorCode": "194", "code": "C-1001", "name": "Örnek Gıda Ltd.", "shortName": "Örnek Gıda", "customerType": "Bakkal", "creditCode": "Deferred", "paymentType": "Open Account", "creditLimit": 50000, "dueDays": 30, "cityName": "İstanbul", "townName": "Kadıköy", "sellerDistributorCode": "194", "sellerCode": "001" }
The response returns the record that was sent. For a new customer with a missing field, 400 is returned with You must send Credit Code, You must send Payment Type, You must send Customer Type, You must send Name for Customer or You must send Short Name for Customer.