Customers
The PostAddCustomer endpoint is responsible for registering a new customer in the MIMS system. This registration can be viewed on screen CAD043.
How to register a customer
HTTP POST Request
| Request Type | Example URL |
|---|---|
| POST | {{url_base}}/PostAddCustomer |
| Example | http://seuIPePorta/datasnap/rest/RESTWebServiceMethods/"PostAddCustomer" |
Input Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| CustomerNo | String(25) | Yes | External code of the customer |
| CustomerAuxiliaryNo | String(25) | No | Auxiliary external code of the customer |
| CorporateName | String(40) | Yes | Customer name |
| BusinessName | String(40) | Yes | Trade name |
| ShortName | String(15) | No | Short name |
| GroupNo | String(25) | No | External code of the customer group |
| Phone | String(15) | No | Phone number |
| String(200) | No | ||
| FoundationDate | Data | No | Foundation date |
| RegisterDate | DataHora | No | Registration date |
| FederalRegisterNo | String(14) | Yes | CNPJ (Legal Entity) or CPF (Individual) |
| StateRegisterNo | String(20) | Yes | State registration (Legal Entity) or ID (Individual) |
| Notes | String(2000) | No | Notes |
| ShelflifeMinPercentage | Float | No | Minimum percentage used in calculating the product expiration date limit for the customer |
| ShelflifeMaxPercentage | Float | No | Maximum percentage used in calculating the product expiration date limit for the customer |
| LocationAddress | AddressInfo | Yes | Object containing the default location address information of the customer |
| DeliveryAddress | AddressInfo | Yes | Object containing the default delivery address information of the customer |
| BillingAddress | AddressInfo | Yes | Object containing the default billing address information of the customer |
| PersonType | PersonType | Yes | Enumerator with possible values for Person Type: ptCompany (Legal Entity) or ptPerson (Individual) |
| IsInactiveCustomer | Boolean | No | Flag indicating that the customer is inactive |
| HasAdministrativeBlocked | Boolean | No | Flag indicating that the customer has administrative block |
| IsRuralProducer | Boolean | No | Flag indicating that the customer is a rural producer |
| RegisterRuralProducerNo | String(20) | No | Rural Producer Registration Number of the Customer |
| SuframaNo | String(20) | No | Customer SUFRAMA code |
| SellerNo | String(25) | No | External code of the seller |
| PriceTableNo | String(25) | No | External code of the price table |
| PromotionalPriceTableNo | String(25) | No | External code of the promotional price table |
| PaymentMethodNo | String(25) | No | External code of the payment method |
| SubLogisticRegionNo | String(25) | No | External code of the sub-logistic region |
| OverwriteIfExists | Boolean | No | Flag indicating that data should be overwritten if the record already exists |
Note
- The requirement of the
LocationAddress,DeliveryAddressandBillingAddressparameters is defined by configuration. By default, these parameters are required. To change this behavior, consult the responsible consultant. - The value provided in the
FederalRegisterNoparameter must respect the size according to the person type specified in thePersonTypeparameter:- 14 characters when
PersonType = ptCompany(corresponds to CNPJ) - 11 characters when
PersonType = ptPerson(corresponds to CPF)
- 14 characters when
Return
| Parameter | Type | Required | Description |
|---|---|---|---|
| WebServiceReturn | WebServiceReturn | Yes | Standard WebService response information in method execution |
| CustomerCode | Integer | Yes | Internal Customer code generated in the MIMS system |
Request Example
curl --location 'http://seuIPePorta/datasnap/rest/RESTWebServiceMethods/"PostAddCustomer"' \
--header 'Content-Type: application/json' \
--data-raw '{
"CustomerNo": "CUST001",
"CustomerAuxiliaryNo": "",
"CorporateName": "Empresa Exemplo Ltda",
"BusinessName": "Empresa Exemplo",
"ShortName": "Exemplo",
"GroupNo": "G001",
"Phone": "11999999999",
"Email": "contato@exemplo.com",
"FoundationDate": "2000-01-01",
"RegisterDate": "2024-02-06T12:00:00",
"FederalRegisterNo": "12345678000195",
"StateRegisterNo": "ISENTO",
"ShelflifeMinPercentage": 15.0,
"ShelflifeMaxPercentage": 60.0,
"Notes": "Cliente com operação ativa",
"LocationAddress": {
"AddressType": "Rua",
"Address": "Av. Paulista",
"Number": "1000",
"District": "Bela Vista",
"ZIPCode": "01310000",
"City": "São Paulo",
"State": "São Paulo",
"StateInitials": "SP",
"Country": "Brasil"
},
"DeliveryAddress": {
"AddressType": "Rua",
"Address": "Av. Paulista",
"Number": "1000",
"District": "Bela Vista",
"ZIPCode": "01310000",
"City": "São Paulo",
"State": "São Paulo",
"StateInitials": "SP",
"Country": "Brasil"
},
"BillingAddress": {
"AddressType": "Rua",
"Address": "Av. Paulista",
"Number": "1000",
"District": "Bela Vista",
"ZIPCode": "01310000",
"City": "São Paulo",
"State": "São Paulo",
"StateInitials": "SP",
"Country": "Brasil"
},
"PersonType": "ptCompany",
"IsInactiveCustomer": false,
"HasAdministrativeBlocked": false,
"IsRuralProducer": true,
"RegisterRuralProducerNo": "PR-2025-0098",
"SuframaNo": "SUF-456789",
"SellerNo": "VEND-015",
"PriceTableNo": "TAB-PRC-01",
"PromotionalPriceTableNo": "TAB-PROMO-02",
"PaymentMethodNo": "PM001",
"SubLogisticRegionNo": "SLR001",
"OverwriteIfExists": true
}'
Response Example
{
"WebServiceReturn": {
"Status": "wrsSuccess",
"ErrorCode": "",
"Message": "",
"Actor": "",
"ReturnQuestion": null
},
"CustomerCode": 12345
}
🐞 Possible Errors
| Code | Message |
|---|---|
| ACT‑001 | The provided External Customer Code parameter (CustomerNo) already exists! |
| ACT‑002 | You indicated that the customer is a rural producer (IsRuralProducer), but did not provide the rural producer registration number (RegisterRuralProducerNo)! |
| ACT‑003 | You provided the rural producer registration number (RegisterRuralProducerNo), but the customer is not a rural producer (IsRuralProducer)! |