Import Contact

Import Contact

To post Webshop Contact into Microsoft Business Central the URL POST http://<serer name>:<odata port>/<service instance name>/api/BEterna/Import/v2.0/companies(<company system id>)/webshopContacts can be used. It must be called with a JSON structure to create an Webshop Contact (webshopChannelCode is mandatory):

{
    "webshopChannel": "123",
    "contactNo": "KT000532",
    "contactName": "BE****",
    "contactName2": "BE****",
    "contactAddress": "Bornaer Strasse",
    "contactHouseNo": "19",
    "contactAddress2": null,
    "contactCity": "Liebertwolkwitz",
    "currencyCode": "Eur",
    "languageCode": "DEU",
    "phoneNo": "+49 34297 648-0",
    "contactCountry": "DE",
    "postCode": "04288",
    "contactCounty": "Sachsen",
    "contactEmail": "info@example.com",
    "firstName": null,
    "contactSurname": null,
    "contactSalutation": null,
    "companyName": null,
    "webshopcontactLines" : [
        {
            "importType": "1",
            "shipToCode": "311",
            "shipToName": "TEST",
            "shipToName2": "TEST2",
            "shipToAddress": "ShipAdress",
            "shipToHouseNo": "2",
            "shipToAddress2": null,
            "shipToCity": "Belgrade",
            "shipToPhoneNo": "+381 81 657777",
            "shipToCountry": "Serbia",
            "shipToPostCode": "11000",
            "shipToCounty": null,
            "shipToEmail": "info@test.com"
        }
    ]
}

If a field is empty it can be left out in the JSON structure. The Webshop Contact fields have the following meaning:

field data type content
webshopChannel Text[30] webshopChannel, must be filled
contactNo Text[20] the No of the Contact
contactName Text[50] the Name of the Contact
contactName2 Text[50] second Name of Contact
contactAddress Text[50] the address of the contact
contactHouseNo Text[10] the House Number of the contact
contactAddress2 Text[50] second address of the contact
contactCity Text[30] the City of the contact
currencyCode Text[10] the Currency Code of the Contact
languageCode Text[30] the language code of the contact
phoneNo Text[30] the phone number of contact
iso_contactCountry Text[10] Country code of the contact
postCode Text[30] the postCode of the address
contactCounty Text[30] the County of the contact
contactEmail Text[80] the Email of the contact
firstName Text[30] the first name of the contact
contactSurname Text[30] Surname of the contact
contactSalutation Text[10] the Salutation of the contact
CompanyName Text[50] Name of the company

There can be one or more Contact Lines. They are transferred using a JSON array. The following fields can be defined for a single Webshop Contact Line:

field data type content
importType Text[10] importType
shipToCode Text[30] the ship To Code value
shipToName Text[50] the ship To Name value
shipToName2 Text[50] second ship To Name value
shipToAddress Text[50] the ship To Address value
shipToHouseNo Text[10] the number of house ship
shipToAddress2 Text[50] the ship To Address value
shipToCity Text[30] ship To City value
shipToPhoneNo Text[30] the ship To PhoneNo value
shipToCountry Text[10] ship To Country value
shipToPostCode Text[30] ship To Post Code value
shipToCounty Text[30] ship To County value
shipToEmail Text[80] ship To Email value

The request is answered with a JSON structure containing all the header data that were transferred. If the answer should contain the transferred order lines as well, the $expand=webshopcontactLines can be attached to the URL and the answer contains the full webshop contact data that were transferred:

{
    "@odata.context": "http://happy-shop-default:7048/BC/api/BEterna/Import/v2.0/$metadata#companies(4ef773bb-a5d1-ec11-bb92-000d3a38eca1)/webshopContacts/$entity",
    "@odata.etag": "W/\"JzQ0O0hGOWlKVGtYSGVLS0lITmF6RWxuVHRuZUsrYjFkdndGYnhieklDTUgzN1E9MTswMDsn\"",
    "systemId": "3f412db6-f700-ed11-be36-9ff83343cf68",
    "webshopChannel": "123",
    "contactNo": "KT000532",
    "contactName": "BEDAV5",
    "contactName2": "BEDAV 2",
    "contactAddress": "Bornaer Strasse",
    "contactHouseNo": "19",
    "contactAddress2": "",
    "contactCity": "Liebertwolkwitz",
    "currencyCode": "Eur",
    "languageCode": "DEU",
    "phoneNo": "+49 34297 648-0",
    "contactCountry": "DE",
    "postCode": "",
    "contactCounty": "Sachsen",
    "contactEmail": "info@bedav.com",
    "firstName": "",
    "contactSurname": "",
    "contactSalutation": "",
    "companyName": "",
    "webshopcontactLines": [
        {
            "@odata.etag": "W/\"JzQ0O1Y5Q1doZU43NlBvZkZCV0xsVmh6Mzh2cUtteUVWOHBBZkRpcE95UkJGd0E9MTswMDsn\"",
            "systemId": "40412db6-f700-ed11-be36-9ff83343cf68",
            "importType": "",
            "shipToCode": "311",
            "shipToName": "TEST",
            "shipToName2": "TEST2",
            "shipToAddress": "ShipAdress",
            "shipToHouseNo": "2",
            "shipToAddress2": "",
            "shipToCity": "Belgrade",
            "shipToPhoneNo": "+381 81 657777",
            "shipToCountry": "Serbia",
            "shipToPostCode": "11000",
            "shipToCounty": "",
            "shipToEmail": "info@test.com"
        }
    ]
}

In this article