Versions Compared

Key

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

...

Posting a new customer (with the friendly code properties)

We suggest to avoid to use avoiding the usage of the friendly code properties when you post a list of Customers of Customers. You should get the Id of the entities before. 

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

The body of the request will until version 2.4 of WinBooks on Web will be like this:


Code Block
{
   "$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:

body from version 2.5 of WinBooks On Web looks like this:

Code Block
{
    "$type": "Winbooks.TORM.OM.Customer, Winbooks.TORM.OM",
    "TotalLevel": 5,
    "Code": "WB6",
    "VatApplicable": 1,
    "Third": {
        "$type": "Winbooks.TORM.OM.Third, Winbooks.TORM.OM",
	    "TotalLevel": 4,
        "Code": "WB6",
        "Name": "Customer WB6",
        "VatNumber": "0000000394",
        "Addresses": [
            {
                "$type": "Winbooks.TORM.OM.Third_Address, Winbooks.TORM.OM",
			    "TotalLevel": 3,
                "IsDelivering": true,
                "IsDeliveringDefault": true,
                "IsPosting": true,
                "IsPostingDefault": true,
                "IsInvoicing": true,
                "IsInvoicingDefault": true,
                "Index": 0,
                "Address": {
                    "$type": "Winbooks.TORM.OM.Address, Winbooks.TORM.OM",
					"TotalLevel": 2,
                    "Address1": "330 Lemonierlaan (WB6)",
                    "Town": "Antwerpen",
                    "Zip": "2000",
                    "PhoneNo": "+3223456789",
					"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/Country/BE/Folder/{{folder}}4bb898f0-21ba-4ea9-9c35-a74d006cd473
GET {{url}}/app/Civility/NV/Folder/{{folder}}9bc5b8f4-3682-46c6-ac84-a74d006cd9ad
GET {{url}}/app/Language/en/Folder/{{folder}}4b2d0fa7-ecf7-4883-9e04-a89d00bcd216
GET {{url}}/app/Currency/EUR/Folder/{{folder}}8d70e1d6-57cf-4bc1-8402-a74d006cd472

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

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

d939ccde-90ec-45bb-97fe-a74d006cd718
GET {{url}}/app/CustomerCategory/BIG/Folder/{{folder}}c3613c92-d081-4a94-a245-a8b3005d2391
GET {{url}}/app/GLAccount/700000/Folder/{{folder}}c61c5554-0803-4286-9315-a74d006cd5aa
GET {{url}}/app/GLAccount/400000/Folder/{{folder}}023a99d0-f1e5-45c8-b902-a74d006cd5a8
GET {{url}}/app/PayCode/7/Folder/{{folder}}48a7b7ab-0f1b-4420-af2e-a74d006cd9a8


Or really more efficiently via the ExecuteCriteria:

GETCurrency/EURGETGLAccount700000/

Request

Body

POST {{url}}/app/Countrys/Folder/{{folder}}/ExecuteCriteria{ "EntityType": "Winbooks.TORM.OM.Countrys, Winbooks.TORM.OM",
"Conditions": [ {"Operator": 0, "PropertyName": "Code", "Values": ["BE"] } ],
"ProjectionsList": [ {"PropertyName": "Id", "Operator": 22} ],
"MaxResult": 1 }
POST {{url}}/app/Civilitys/Folder/{{folder}}/ExecuteCriteria{ "EntityType": "Winbooks.TORM.OM.ThirdCivility, Winbooks.TORM.OM",
"Conditions": [ {"Operator": 0, "PropertyName": "Code", "Values": ["NV"] } ],
"ProjectionsList": [ {"PropertyName": "Id", "Operator": 22} ],
"MaxResult": 1 }
POST {{url}}/app/Languages/Folder/{{folder}}/ExecuteCriteria{ "EntityType": "Winbooks.TORM.OM.Language, Winbooks.TORM.OM",
"Conditions": [ {"Operator": 0, "PropertyName": "Code", "Values": ["en"] } ],
"ProjectionsList": [ {"PropertyName": "Id", "Operator": 22} ],
"MaxResult": 1 }
POST {{url}}/app/Currencys/Folder/{{folder}}/ExecuteCriteria

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

POST

Request

Id

GET {{url}}/app/Country/BE/Folder/{{folder}}4bb898f0-21ba-4ea9-9c35-a74d006cd473
GET {{url}}/app/CivilityVatAccounts/NV/Folder/{{folder}}9bc5b8f4-3682-46c6-ac84-a74d006cd9ad
GET {{url}}/app/Language/en/Folder/{{folder}}4b2d0fa7-ecf7-4883-9e04-a89d00bcd216
/ExecuteCriteria

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

POST {{url}}/app/GLAccounts/Folder/{{folder}}8d70e1d6-57cf-4bc1-8402-a74d006cd472

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

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

d939ccde-90ec-45bb-97fe-a74d006cd718
GET {{url}}/app/CustomerCategory/BIG/Folder/{{folder}}c3613c92-d081-4a94-a245-a8b3005d2391
/ExecuteCriteria{ "EntityType": "Winbooks.TORM.OM.Accounting.GLAccount, Winbooks.TORM.OM",
"Conditions": [ {"Operator": 0, "PropertyName": "Code", "Values": ["700000"] } ],
"ProjectionsList": [ {"PropertyName": "Id", "Operator": 22} ],
"MaxResult": 1 }
POST {{url}}/app/GLAccounts/Folder/{{folder}}c61c5554-0803-4286-9315-a74d006cd5aa
GET {{url}}/app/GLAccount/400000/Folder/{{folder}}023a99d0-f1e5-45c8-b902-a74d006cd5a8
GET {{url}}/app/PayCode/7/Folder/{{folder}}48a7b7ab-0f1b-4420-af2e-a74d006cd9a8

Or really more efficiently via the ExecuteCriteria:

BodyCountrysCountrysBE{ "EntityType":
/ExecuteCriteria{ "EntityType": "Winbooks.TORM.OM.Accounting.GLAccount, Winbooks.TORM.OM",
"Conditions": [ {"Operator": 0, "PropertyName": "Code", "Values": ["400000"] } ],
"ProjectionsList": [ {"PropertyName": "Id", "Operator": 22} ],
"MaxResult": 1 }

Request

POST {{url}}/app/PayCodes/Folder/{{folder}}/ExecuteCriteria

{ "EntityType": "Winbooks.TORM.OM.

Accounting.PayCode, Winbooks.TORM.OM",
"Conditions": [ {"Operator": 0, "PropertyName": "Code", "Values": ["

7"] } ],
"ProjectionsList": [ {"PropertyName": "Id", "Operator": 22} ],
"MaxResult": 1 }

POST {{url}}/app/Civilitys/Folder/{{folder}}/ExecuteCriteria


To post the customer, the body will be this one (version <= 2.4):

Code Block
{
   "$type": "Winbooks.TORM.OM.

...

Customer, Winbooks.TORM.OM

...

",
   "TotalLevel": 3,
   "Vat_Id": "d939ccde-90ec-45bb-97fe-a74d006cd718",
   "CustomerCategory_Id": "c3613c92-d081-4a94-a245-a8b3005d2391",
   "GLAccount_Id": "c61c5554-0803-4286-9315-a74d006cd5aa",
   "GLAccount2_Id": "023a99d0-f1e5-45c8-b902-a74d006cd5a8",
   "PayCode_Id": "bee3ad14-c3b0-4284-80e7-a74d006cd9a8",
   "Code": "TEST2",
   "VatApplicable": 1,
   "IsLocked": false,
   "IsHidden": false,
   "MemoType": 0,
   "Third": {
      "$type": "Winbooks.TORM.OM.

...

Third, Winbooks.TORM.OM",

...

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

...


      "TotalLevel": 2,
      "ThirdCivility_Id": "9bc5b8f4-3682-46c6-ac84-a74d006cd9ad",
      "VatCountry_Id": "4bb898f0-21ba-4ea9-9c35-a74d006cd473",
      "Language_Id": "4b2d0fa7-ecf7-4883-9e04-a89d00bcd216",
      "Currency_Id": "8d70e1d6-57cf-4bc1-8402-a74d006cd472",
      "Code": "TEST2",
      "Name": "The Test Company 2",
      "VatNumber": "0000000295",
      "WebSite": "www.test2.be",
      "Addresses": [
         {
            "$type": "Winbooks.TORM.OM.

...

Address, Winbooks.TORM.OM",

...

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


            "TotalLevel": 1,
            "Country_Id": "4bb898f0-21ba-4ea9-9c35-a74d006cd473",
            "Index": 0,
            "Address1": "Vuchtlaan 79",
            "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
         }
      ]
   }
}


And this one for the version >= 2.5:

Code Block
{
 

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

...

   "$type": "Winbooks.TORM.OM.Customer, Winbooks.TORM.OM",

...


	"TotalLevel": 4,
    "

...

Code": "

...

WB5",
    "

...

Vat_Id": "

...

1d625e47-

...

4871-

...

450b-

...

91c8-

...

9f9400b4ca36",
    "

...

GLAccount_Id": "

...

5633a32d-

...

c312-

...

4e19-

...

9e6b-

...

9f9400b4c691",
    "

...

GLAccount2_Id": "

...

d2647e20-

...

8267-

...

4703-

...

90c0-9f9400b4c67a",
    "

...

PayCode_Id": 

...

"f6a39f52-a79d-4758-933a-9f9400b4d059",
    "

...

VatApplicable": 

...

1,
    "

...

Code": 

...

"WB5",
    "Third": {
        "$type": "Winbooks.TORM.OM.Third, Winbooks.TORM.OM",
    

...

	"TotalLevel": 

...

3,
        "

...

Code": "

...

WB5",

...


        "

...

ThirdCivility_Id": "

...

5f4964b8-

...

00f2-

...

464f-

...

a01d-

...

9f9400b4d0ce",

...


        "

...

VatCountry_Id": "

...

8f8a337e-

...

b483-

...

4c30-

...

b6ed-

...

9f9400b4c553",
        "

...

Language_Id": "

...

5dc36906-

...

5d31-

...

4ff9-

...

b20c-

...

9f9400b4c5df",
        "

...

Currency_Id": "

...

2b790e84-f9f5-4ff6-b775-9f9400b4c54e",
        "Name": "

...

Customer WB5",
        "VatNumber": "

...

0000000394",
        "

...

Code": "

...

WB5",
        "Addresses": [
            {
                "$type": "Winbooks.TORM.OM.

...

Third_Address, Winbooks.TORM.OM",
				"TotalLevel": 

...

2,
            

...

    "IsDelivering": 

...

true,
                "

...

IsDeliveringDefault": 

...

true,
                "

...

IsPosting": 

...

true,
                "

...

IsPostingDefault": 

...

true,
                "

...

IsInvoicing": 

...

true,
                "

...

IsInvoicingDefault": 

...

true,
                "

...

Index": 

...

0,
                "

...

Address": 

...

{
            

...

        "$type": "Winbooks.TORM.OM.Address, Winbooks.TORM.OM",
					"TotalLevel": 1,
           

...

 

...

        

...

"Country_Id": "8f8a337e-b483-4c30-b6ed-9f9400b4c553",

...


         

...

 

...

          

...

"

...

Address1": "330 Lemonierlaan (WB5)",
            

...

        "Town": 

...

"Antwerpen",
        

...

            "

...

Zip": 

...

"2000",
            

...

 

...

       "PhoneNo": "+3223456789"
    

...

 

...

           

...

}
            }
        ]
    }
}




Check if a Customer exists

...