Skip to main content

RestJson - Customer sync

RestJson Connector - Customer Update This document describes the process of synchronizing customer data from a JSON-based REST API to the ...

Updated over a week ago

RestJson Connector - Customer Update

This document describes the process of synchronizing customer data from a JSON-based REST API to the App4Sales platform. The process updates customers, addresses, contacts, and other related information.

Data Source Configuration

The connector fetches customer data from a RESTful API. The base URL for the API is configured in the connector settings.

  • Customers Endpoint: /Customers

  • Contacts Endpoint: /Contacts

  • Addresses Endpoint: /Addresses

  • Notes Endpoint: /Notes

The connector retrieves customers in batches, sorted by Code. For each customer, it can conditionally fetch associated contacts and addresses from their respective endpoints if they are not included in the main customer payload.

Customer Core Fields

App4Sales Field

Source Field (API/Excel/DB)

Logic/Notes

CustomerGuid

Id

Direct mapping from the source Id.

CustomerCode

Code

Direct mapping from the source Code.

CustomerName

Name, IsProspect, IsSuspect

The name is prefixed with "[P] " if IsProspect is true and the UsePrefixForProspectsAndSuspects setting is enabled. It is prefixed with "[S] " if IsSuspect is true and the same setting is enabled. Otherwise, it's a direct mapping of Name.

Discount

Discount

Direct mapping of the customer's discount percentage.

Website

Website

Direct mapping of the customer's website URL.

VatLiable

VatLiable

Boolean flag indicating if the customer is liable for VAT.

VatCode

VatCode

Direct mapping of the customer's VAT code.

ChamberOfCommerceCode

ChamberOfCommerceCode

Direct mapping from the source ChamberOfCommerceCode.

CustomerEnabled

IsBlocked

The customer is enabled if IsBlocked is false.

CustomerManager

CustomerManager

Direct mapping of the account manager for the customer.

LanguageCode

LanguageCode

Direct mapping of the customer's language code.

Sysmodified

Modified

Mapped from the Modified field. If null, the current date and time is used.

Created

Created

Mapped from the Created field. If null, the current date and time is used.

Phone

Phone

Direct mapping of the customer's main phone number.

Email

Email

Direct mapping of the customer's main email address.

Fax

Fax

Direct mapping of the customer's main fax number.

UsesPriceField

PriceList, PriceListExternalId

The system tries to find a matching price list based on the PriceList (GUID) or PriceListExternalId. The Code of the found price list is used as the value. Defaults to 1 if no match is found.

PaymentConditionCode

PaymentCondition, PaymentConditionCode

The system looks up the payment condition by the PaymentCondition (GUID). If not found, it uses the PaymentConditionCode directly.

DeliveryMethod

DeliveryMethodCode

Direct mapping of the delivery method code.

CustomerClassification

CustomerClassification

Direct mapping of the customer classification.

CustomerDashboard

DashboardUrl

The content of the URL specified in DashboardUrl is downloaded and stored as a Base64 string.

Addresses

Addresses are retrieved from the /Addresses endpoint if not provided in the customer payload. The mapping is as follows:

App4Sales Field

Source Field (API/Excel/DB)

Logic/Notes

AddressId

Id

Mapped from the address Id.

ExternalId

Id

Mapped from the address Id if it's not an empty GUID.

AddressLine1

AddressLine1

Direct mapping.

AddressLine2

AddressLine2

Direct mapping.

AddressLine3

AddressLine3

Direct mapping.

PostCode

PostalCode

Direct mapping.

City

City

Direct mapping.

Country

Country

Direct mapping.

Iso2

CountryCode

Mapped from the CountryCode field.

AddressType

Type

Direct mapping of the address type (e.g., 'vis' for visiting, 'del' for delivery).

IsMainAddress

IsMainAddress

Boolean flag indicating if this is the main address.

Email

(from Customer)

Inherited from the main customer's Email.

Phone

(from Customer)

Inherited from the main customer's Phone.

Fax

(from Customer)

Inherited from the main customer's Fax.

Contacts

Contact persons are retrieved from the /Contacts endpoint if not provided in the customer payload.

App4Sales Field

Source Field (API/Excel/DB)

Logic/Notes

ContactId

Id, ContactId

Uses ContactId if available, otherwise falls back to the GUID from Id.

FirstName

FirstName

Direct mapping.

MiddleName

MiddleName

Direct mapping.

LastName

LastName

Direct mapping.

FullName

FirstName, MiddleName, LastName

Concatenation of first name, middle name, and last name.

Email

Email

Direct mapping.

Phonenumber

Phone

Direct mapping.

MobileNumber

Mobile

Direct mapping.

IsMainContactPerson

IsMainContact

Boolean flag indicating if this is the main contact.

Language_iso2

LanguageCode

Mapped from the LanguageCode field.

Function

Function

Direct mapping.

Gender

Gender

Direct mapping.

Initials

Initials

Direct mapping.

UserName

Username

Direct mapping.

Extra Data & Free Fields

The connector supports custom fields through two mechanisms: Free Fields and Dynamic Free Fields.

App4Sales Field

Source Field (API/Excel/DB)

Logic/Notes

FreeFields

FreeFields

The list of key-value pairs in FreeFields is serialized into an XML string.

DynamicFreeFields

CustomCustomerFields

The list of key-value pairs in CustomCustomerFields is serialized into a different XML structure for dynamic fields.

Notes

Customer notes are retrieved from the /Notes endpoint.

App4Sales Field

Source Field (API/Excel/DB)

Logic/Notes

(CustomerNote)

Notes

Customer notes are fetched and stored. If the setting PlaceNoteStateInSubject is enabled, the note's subject is prefixed with its state.

Related Settings & Prerequisites

The following settings influence the customer update process:

  • UsePrefixForProspectsAndSuspects: If enabled, customer names are prefixed with [P] for prospects and [S] for suspects.

  • IfListIsEmptyUseLegacyEndpoint: If enabled, the connector will make separate calls to the /Contacts and /Addresses endpoints if the respective lists are empty in the customer payload.

  • DisableCustomerBatchUpdate: If enabled, the connector will only process one batch of customers. This is intended for debugging.

  • GetCustomerNotesFromBackoffice: If enabled, the connector will fetch customer notes from the /Notes endpoint.

  • PlaceNoteStateInSubject: If enabled, the state of a customer note will be prepended to its subject.

Did this answer your question?