Skip to main content

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 TypeExample URL
POST{{url_base}}/PostAddCustomer
Examplehttp://seuIPePorta/datasnap/rest/RESTWebServiceMethods/"PostAddCustomer"

Input Parameters

ParameterTypeRequiredDescription
CustomerNoString(25)YesExternal code of the customer
CustomerAuxiliaryNoString(25)NoAuxiliary external code of the customer
CorporateNameString(40)YesCustomer name
BusinessNameString(40)YesTrade name
ShortNameString(15)NoShort name
GroupNoString(25)NoExternal code of the customer group
PhoneString(15)NoPhone number
EmailString(200)NoEmail
FoundationDateDataNoFoundation date
RegisterDateDataHoraNoRegistration date
FederalRegisterNoString(14)YesCNPJ (Legal Entity) or CPF (Individual)
StateRegisterNoString(20)YesState registration (Legal Entity) or ID (Individual)
NotesString(2000)NoNotes
ShelflifeMinPercentageFloatNoMinimum percentage used in calculating the product expiration date limit for the customer
ShelflifeMaxPercentageFloatNoMaximum percentage used in calculating the product expiration date limit for the customer
LocationAddressAddressInfoYesObject containing the default location address information of the customer
DeliveryAddressAddressInfoYesObject containing the default delivery address information of the customer
BillingAddressAddressInfoYesObject containing the default billing address information of the customer
PersonTypePersonTypeYesEnumerator with possible values for Person Type: ptCompany (Legal Entity) or ptPerson (Individual)
IsInactiveCustomerBooleanNoFlag indicating that the customer is inactive
HasAdministrativeBlockedBooleanNoFlag indicating that the customer has administrative block
IsRuralProducerBooleanNoFlag indicating that the customer is a rural producer
RegisterRuralProducerNoString(20)NoRural Producer Registration Number of the Customer
SuframaNoString(20)NoCustomer SUFRAMA code
SellerNoString(25)NoExternal code of the seller
PriceTableNoString(25)NoExternal code of the price table
PromotionalPriceTableNoString(25)NoExternal code of the promotional price table
PaymentMethodNoString(25)NoExternal code of the payment method
SubLogisticRegionNoString(25)NoExternal code of the sub-logistic region
OverwriteIfExistsBooleanNoFlag indicating that data should be overwritten if the record already exists
Note
  • The requirement of the LocationAddress, DeliveryAddress and BillingAddress parameters is defined by configuration. By default, these parameters are required. To change this behavior, consult the responsible consultant.
  • The value provided in the FederalRegisterNo parameter must respect the size according to the person type specified in the PersonType parameter:
    • 14 characters when PersonType = ptCompany (corresponds to CNPJ)
    • 11 characters when PersonType = ptPerson (corresponds to CPF)

Return

ParameterTypeRequiredDescription
WebServiceReturnWebServiceReturnYesStandard WebService response information in method execution
CustomerCodeIntegerYesInternal 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

CodeMessage
ACT‑001The provided External Customer Code parameter (CustomerNo) already exists!
ACT‑002You indicated that the customer is a rural producer (IsRuralProducer), but did not provide the rural producer registration number (RegisterRuralProducerNo)!
ACT‑003You provided the rural producer registration number (RegisterRuralProducerNo), but the customer is not a rural producer (IsRuralProducer)!