Page History
Posting a new Document
First, we have to retrieve the Id of the address. This can be done by 2 ways.
If we manage the contact person in the document, we should also retrieve the Id of the contact.
Load the third BEBOP
GET {{url}}/app/Third/BEBOP/Folder/{{folder}}?MaxLevel=2
...
This request generates several SQL queries to fetch all the sub-entities (MaxLevel=2 to get the DefaultAddress), and we don't need most of the sub-entities.
Make a query
It's really more efficient to use queries and especially queries with projection to get just what we need. This can be done with the /ExecuteCriteria suffixe.
...
The body of the request contains the criteria corresponding to this query in .NET:
|
Body for the ExecuteCriteria in JSON:
...
[ "56e918d4-0cc0-42db-a040-a89b00aa382d" ]
Post the DocumentHeader (using the friendly code properties)
POST {{url}}/app/DocumentHeader/Folder/{{folder}}
...
{ "Href": "https://stg-api.winbooksonweb.be/app/DocumentHeader/6caa4a57-4db0-464a-834d-a8aa00ae41a4/Folder/JF_TEST_RESTAPI" }
Post the DocumentHeader (using the Id's)
It is more efficient to specify the Id's of the related entities, especially when we post several documents using the same journal or customer or items or vat or currency.
First, we have to retrieve the Id's:
Request | Id |
---|---|
GET {{url}}/app/Vat/21/Folder/{{folder}} | d939ccde-90ec-45bb-97fe-a74d006cd718 |
GET {{url}}/app/Item/WHEEL/Folder/{{folder}} | 9976a7a9-f27b-4d5d-a414-a8a300c385ad |
GET {{url}}/app/Item/FRAME/Folder/{{folder}} | 41ec5756-f160-4d4f-909c-a8a300c3caea |
GET {{url}}/app/JournalLog/ORDER/Folder/{{folder}} | 1104bd81-fac3-498d-bdb1-a74d006d9096 |
GET {{url}}/app/Customer/BEBOP/Folder/{{folder}} | f5e92880-31c0-43af-9348-a85d0117d78b |
GET {{url}}/app/Currency/EUR/Folder/{{folder}} | 8d70e1d6-57cf-4bc1-8402-a74d006cd472 |
GET {{url}}/app/PayCode/7/Folder/{{folder}} | 48a7b7ab-0f1b-4420-af2e-a74d006cd9a8 |
Or really more efficiently via the ExecuteCriteria:
Request | Body |
---|---|
POST {{url}}/app/VatAccounts/Folder/{{folder}}/ExecuteCriteria | { "EntityType": "Winbooks.TORM.OM.Accounting.VatAccount, Winbooks.TORM.OM", |
POST {{url}}/app/Items/Folder/{{folder}}/ExecuteCriteria | { "EntityType": "Winbooks.TORM.OM.Logistics.Item, Winbooks.TORM.OM", |
POST {{url}}/app/Items/Folder/{{folder}}/ExecuteCriteria | { "EntityType": "Winbooks.TORM.OM.Logistics.Item, Winbooks.TORM.OM", "Conditions": [ {"Operator": 0, "PropertyName": "Code", "Values": ["FRAME"] } ], "ProjectionsList": [ {"PropertyName": "Id", "Operator": 22} ], "MaxResult": 1 } |
POST {{url}}/app/JournalLogs/Folder/{{folder}}/ExecuteCriteria | { "EntityType": "Winbooks.TORM.OM.Logistics.JournalLog, Winbooks.TORM.OM", |
POST {{url}}/app/Customers/Folder/{{folder}}/ExecuteCriteria | { "EntityType": "Winbooks.TORM.OM.Customer, Winbooks.TORM.OM", |
POST {{url}}/app/Currencys/Folder/{{folder}}/ExecuteCriteria | { "EntityType": "Winbooks.TORM.OM.Currency, Winbooks.TORM.OM", |
POST {{url}}/app/PayCodes/Folder/{{folder}}/ExecuteCriteria | { "EntityType": "Winbooks.TORM.OM.Accounting.PayCode, Winbooks.TORM.OM", |
POST {{url}}/app/DocumentHeader/Folder/{{folder}}
...