Customers
Normalize one customer payload
/a/Customer_checkData
Normalize one proposed customer payload and report the fields changed and validation problems found, without saving a customer.
When to use this endpoint
Use Customer_checkData to preview the legacy import normalizations for one customer-shaped object.
This is not the CRM2 create validator. Customer_createData applies a different mapped-field contract and performs its own tenant-setting checks.
Authentication and permissions
The handler does not require login, an API user, or tenant context. Do not send private customer data to it unless the surrounding transport and caller are trusted.
It reads only the submitted values and repository country/telephone lookup tables; it does not read tenant customer records.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
name | String | No | Trimmed. If omitted, the legacy normalizer inserts MISSING NAME; it does not return a missing-name error. |
country | String | No | Trimmed and uppercased, then normalized from a known name or alpha-2 code to alpha-3. Unknown values are retained and reported in errors. |
landline | String | No | Punctuation is removed, leading 00 becomes +, and a country/dialling code may be inferred. Invalid international numbers can add an error. |
city | String | No | Trimmed and title-cased. A known city can supply a missing country. |
street_address_1 | String | No | Trimmed. A two- or three-part comma-separated value may be split across address fields when those target fields are absent. |
street_address_2 | String | No | Trimmed; moved to the first address line when that line is blank, or removed when it duplicates another address component. |
town | String | No | May be removed when it duplicates an address line. |
county | String | No | For a GBR customer with no postcode, this and the other address fields are searched for a postcode. |
postcode | String | No | When absent for GBR, a postcode embedded in county, town, or either address line is extracted. |
_poll | Any | No | Dispatcher polling metadata. It is removed from the returned customer object. All other unrecognized properties pass through unchanged. |
Example request
$preview = FM_api('Customer_checkData', [
'name' => ' Northwind Belfast ',
'country' => 'Northern Ireland',
'street_address_2' => '14 Harbour Road, Belfast',
]);
Example response
{
"customer": {
"name": "Northwind Belfast",
"country": "GBR",
"street_address_1": "14 Harbour Road",
"street_address_2": "Belfast"
},
"corrections": ["name", "country", "street_address_1", "street_address_2"],
"errors": []
}
customer is the submitted object after repeated normalization passes. corrections and errors contain unique strings in first-seen order.
Errors and unusual responses
| Response | Condition |
|---|---|
errors: ["unknown country: <VALUE>"] | The nonblank country is not a recognized country name, alpha-2 code, three-character value, or the special Northern Ireland spelling. |
errors: ["invalid landline: <VALUE>"] | The telephone library cannot parse a number beginning with +. Other corrections can still be returned. |
Validation findings are elements of errors; the endpoint still returns the normal three-key response and commonly uses HTTP 200.
Behaviour and edge cases
- Each loop pass makes at most one early correction, then restarts, so later rules see earlier normalized values.
- The country special case accepts exact normalized
NORTHERN IRELANDasGBR. Any other three-character country value is accepted without checking that it is assigned. - Postcode extraction changes the customer object but does not add the affected fields to
corrections. This is a legacy reporting omission. - The code computes collapsed internal whitespace for address lines and town but does not write that whitespace-only change back unless another address rule also changes the field.
- There is no pagination, filtering, or database write.
See it in Fieldmotion
CRM1
No production CRM1 caller was found. Customer import uses the plural preview endpoint for batches.
CRM2
No production CRM2 caller was found. The configurable customer editor uses mapped create/update endpoints instead.
Related endpoints
Customers_checkDataapplies this normalizer to imported rows and adds batch-level matching information.Customer_createDatacreates a mapped CRM2 customer record.