Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The customer entity is referencing several other entities.

The schema  is this one for version <= 2.4:

  • Customer

    • Third

      • DefautAddress

      • Addresses (List of OM.Address)

      • Contacts (List of OM.Third_Contact)

      • BankAccounts (List of OM.BankAccount)

The schema  is this one for version >= 2.5:

  • Customer

    • Third

      • DefautAddress

      • Addresses (List of OM.Third_Address)

        • Address (OM.Address)
      • Contacts (List of OM.Third_Contact)

      • BankAccounts (List of OM.BankAccount)

...

PropertyTypeId fieldFriendly property codeComment

Code

string



Should be the same as the code of the Customer

ThirdCivility

OM.ThirdCivility

ThirdCivility_Id

CivilityCode

Ex: "NV"

VatCountry

OM.Country

VatCountry_Id

VatCountryCode

Ex: "BE"

Language

OM.Language

Language_Id

LanguageCode

Ex: "nl"

Currency

OM.Currency

Currency_Id

CurrencyCode

Ex: "EUR"

DefautAddress

OM.DefaultAddress




Addresses

List of OM.Address
List of OM.Third_Address



for version <= 2.4
for version >= 2.5

Contacts

List of OM.Third_Contact




BankAccountsList of OM.BankAccount


VatNumber

string



Ex: "0000000196" (without formatting)

WebSite

string



Ex: "www.bebop.be"

...

PropertyTypeId fieldFriendly property codeComment
Indexshort

Allows to order the list of the addresses of a third party
ThirdOM.ThirdThird_IdThirdCode
CountryOM.CountryCountry_IdCountryCode
Address1string


Address2string


Townstring


Zipstring


Namestring

The name of the company at this address. Could be different from the name of the third party
Numberstring

Not used now. The number is put in Address1 or Address2.
Boxstring

Not used now.
PhoneNostring


FaxNostring


MemoTypeshort

Cfr Customer.MemoType
Memostring


IsDeliveringbool

for version <= 2.4, true - it's a delivery address
IsDeliveringDefaultbool

for version <= 2.4, true - it's the one by default
IsPostingbool

for version <= 2.4, true - it's a posting address (where we send the invoices)
IsPostingDefaultbool

for version <= 2.4, true - it's the one by default
IsInvoicingbool

for version <= 2.4, true - it's an invoicing address (the address printed on the invoice)
IsInvoicingDefaultbool

for version <= 2.4, true - it's the default one
CustomIDictionnary<string, object>

List of custom fields + values

...

No Format
{
    "$type": "Winbooks.TORM.OM.Address, Winbooks.TORM.OM",
    "TotalLevel": 1,
    "Version": 13,
    "Modified": "/Date(1520504972000)/",
    "ModifiedBy": "7507ea76-474b-4ccc-80d3-a35b0090b2b6",
    "Created": "/Date(1520327985000)/",
    "CreatedBy": "7507ea76-474b-4ccc-80d3-a35b0090b2b6",
    "Folder_Id": "3a6a9ea1-ce6e-45e7-889a-d8e325a43b70",
    "Third_Id": "7fd099fb-1a6e-43c6-b315-a85d0117d790",
    "Country_Id": "4bb898f0-21ba-4ea9-9c35-a74d006cd473",
    "Index": 0,
    "Address1": "Vuchtlaan 76",
    "Address2": "",
    "Town": "Antwerpen  ",
    "Zip": "2000  ",
    "Name": "",
    "Number": "",
    "Box": "",
    "PhoneNo": "+3233215476",
    "FaxNo": "",
    "MemoType": 0,
    "Memo": "",
    "IsDelivering": true,
    "IsDeliveringDefault": true,
    "IsPosting": true,
    "IsPostingDefault": true,
    "IsInvoicing": true,
    "IsInvoicingDefault": true,
    "Id": "56e918d4-0cc0-42db-a040-a89b00aa382d",
    "ResultState": 0,
    "ActionState": 0,
    "CachedCollection": {},
    "IsBinding": false,
    "IsSpecifiedId": false,
    "IsDirty": false,
    "UpdatedEntities": {},
    "Custom": {},
    "UpdatedProperties": [],
    "UpdatedValues": [],
    "FolderCode": "JF_TEST_RESTAPI",
    "ThirdCode": "BEBOP",
    "CountryCode": "BE"
}


Third_Address (version >= 2.5)

PropertyTypeId fieldFriendly property codeComment
ThirdOM.ThirdThird_IdThirdCode
ContactOM.ContactContact_Id

Indexint

0, 1, ...
AddressOM.AddressAddres_Id

IsDeliveringbool


IsDeliveringDefaultbool


IsInvoicingbool


IsInvoicingDefaultbool


IsPostingbool


IsPostingDefaultbool


Third_Contact

Type: OM.Third_Contact

This entity allows to make a relation N-M between Third and Contact.

...

See inside of the Third example for the BankAccount format in JSON.

Examples

Posting a new customer (with the friendly codes)

POST {{url}}/app/Customer/TEST/Folder/{{folder}}

The body of the request will be like this:

No Format
{
   "$type": "Winbooks.TORM.OM.Customer, Winbooks.TORM.OM",
   "TotalLevel": 4,
   "Code": "TEST",
   "VatApplicable": 1,
   "IsLocked": false,
   "IsHidden": false,
   "MemoType": 0,
   "Third": {
      "$type": "Winbooks.TORM.OM.Third, Winbooks.TORM.OM",
      "TotalLevel": 3,
      "Code": "TEST",
      "Name": "The Test Company",
      "VatNumber": "0000000196",
      "WebSite": "www.test.be",
      "Addresses": [
         {
            "$type": "Winbooks.TORM.OM.Address, Winbooks.TORM.OM",
            "TotalLevel": 2,
            "Index": 0,
            "Address1": "Vuchtlaan 78",
            "Address2": "",
            "Town": "Antwerpen",
            "Zip": "2000",
            "Name": "",
            "Number": "",
            "Box": "",
            "PhoneNo": "+3233215476",
            "FaxNo": "",
            "MemoType": 0,
            "Memo": "",
            "IsDelivering": true,
            "IsDeliveringDefault": true,
            "IsPosting": true,
            "IsPostingDefault": true,
            "IsInvoicing": true,
            "IsInvoicingDefault": true,
            "CountryCode": "BE"
         }
      ],
      "CivilityCode": "NV",
      "VatCountryCode": "BE",
      "LanguageCode": "en",
      "CurrencyCode": "EUR"
   },
   "VatCode": "21",
   "CategoryCode": "EU",
   "GLAccountDefaultCode": "700000",
   "GLAccountCentralCode": "400000",
   "PayCodeCode": "30"
}

The last level (Addresses) has TotalLevel = 2 because we use the friendly code property (CountryCode). If we use the Id's instead, we have to put TotalLevel = 1 for the last level.

Do not use the DefaultAddress entity which does not support the posting.

Posting a new Customer (with the Id's)

It is more efficient to specify the Id's of the related entities, especially when we post several customers using the same country, civility, language, currency, vat, category, default account, central account or payment term (PayCode).

First, we have to retrieve the Id's:

...

Request

...

Id

...

GET {{url}}/app/Vat/21/Folder/{{folder}}
or

GET {{url}}/app/VatAccount/21/Folder/{{folder}}

...


Or really more efficiently via the ExecuteCriteria:

...

Request

...

Body

...

{ "EntityType": "Winbooks.TORM.OM.Currency, Winbooks.TORM.OM",
"Conditions": [ {"Operator": 0, "PropertyName": "Code", "Values": ["EUR"] } ],
"ProjectionsList": [ {"PropertyName": "Id", "Operator": 22} ],
"MaxResult": 1 }

...

{ "EntityType": "Winbooks.TORM.OM.Accounting.VatAccount, Winbooks.TORM.OM",
"Conditions": [ {"Operator": 0, "PropertyName": "Code", "Values": ["21"] } ],
"ProjectionsList": [ {"PropertyName": "Id", "Operator": 22} ],
"MaxResult": 1 }

...

{ "EntityType": "Winbooks.TORM.OM.Accounting.PayCode, Winbooks.TORM.OM",
"Conditions": [ {"Operator": 0, "PropertyName": "Code", "Values": ["7"] } ],
"ProjectionsList": [ {"PropertyName": "Id", "Operator": 22} ],
"MaxResult": 1 }

To post the customer, the body will be then this one:

...

Children Display