Sales Agreements
A Sales Agreement is an entity to define a sale header and a list of items connected to the sale header in the Wisefish system.
An item GET request URL looks like this: https://api.businesscentral.dynamics.com/v2.0/{TenantId}/{Environment}/api/wisefish/wiFiEP/v1.0/companies({CompanyId})/salesAgreementHeaders
This endpoint only supports GET so no updates or inserts are allowed.
Sales Agreements can be filtered by most of the values in the response by using ?$filter for OData.
Example of a filter where I only get headers modified after a specific date:
?$filter=lastModified gt 2024-06-19T16:36:14.263Z
Response Example
{
"@odata.context": "https://api.businesscentral.dynamics.com/v2.0/b9559d9b-8fc8-4233-b617-00a14ef0a761/SalesAndConsulting/api/wisefish/wiFiEP/v1.0/$metadata#companies(1f98360c-1b96-ef11-8a6d-0022489ea62d)/salesAgreementHeaders",
"value": [
{
"@odata.etag": "W/\"JzIwOzE3Njk4NTAxMzk1NDM5Njg2ODc0MTswMDsn\"",
"systemId": "603a5b67-dacc-ee11-9078-000d3a64d7c6",
"documentType": "Delivery",
"no": "DA2400001",
"sellToCustomerNo": "1001000",
"sellToName": "Kingdom Customer 1",
"shipToCode": "",
"shipToName": "Kingdom Customer 1",
"shipToNam2": "",
"shipToAddress": "",
"shipToAddress2": "",
"shipToCity": "",
"shipToContact": "",
"shipToPostCode": "",
"shipToCounty": "",
"shipToCountryRegionCode": "",
"shipmentMethodCode": "EXW",
"shipmentDate": "2024-02-16",
"shippingAgentCode": "",
"shippingAgentServiceCode": "",
"shippingFacilityCode": "",
"shippingReferenceType": " ",
"shippingReferenceNo": "",
"shippingReferenceConsignee": "",
"transportMethodCode": "1",
"transporter": "",
"placeOfDelivery": "",
"placeOfLoading": "",
"placeOfDischarge": "",
"placeOfDestination": "",
"languageCode": "ENG",
"lastDateModified": "0001-01-01T00:00:00Z",
"lastModified": "2024-02-16T14:54:09.817Z"
},
{
"@odata.etag": "W/\"JzE5Ozk5NTg2MzQ4ODc0NTU3MTc0MjgxOzAwOyc=\"",
"systemId": "b97c321c-12d0-ee11-9078-000d3a64d7c6",
"documentType": "Delivery",
"no": "DA2400002",
"sellToCustomerNo": "2001000",
"sellToName": "Forward 1 - USD",
"shipToCode": "",
... ...
The response above does not include the item lines in the sales header, if you want to receive the item lines at the same time as the headers you can add an $expand command to the GET request like this:
/salesAgreementHeaders?$expand=salesAgreementLines
And then you get an array with the lines included in the header reply like this:
"lastModified": "2024-02-16T14:54:09.817Z",
"salesAgreementLines": [
{
"@odata.etag": "W/\"JzE5OzEzMzU1Mjc1OTA0OTM5NjE5NDcxOzAwOyc=\"",
"systemId": "6c5b5d7a-dacc-ee11-9078-000d3a64d7c6",
"itemNo": "01-000001",
"itemDescription": "Cod Fillet - Loin",
"quantity": 100,
"noOfTradeItems": 100,
"unit": "BOX",
"tiUnitOfMeasure": "BOX",
"type": "Item",
"salesTransWeight": 0,
"salesTransNrOfTradeItems": 0,
"documentNo": "DA2400001",
"lineNo": 10000,
"salesTransBaseUOM": "",
"salesTransQtyPerTI": "",
"qtyPerUnitOfMeasure": 0,
"qtyPerTI": 0,
"allocatedNrOfTis": 0,
"allocatedQuantity": 0,
"documentType": "Delivery",
"lastModified": "2024-02-16T14:54:09.813Z"
}
... more entries if available
]
You can also query the sales agreement lines only by drilling down to a specific sales agreement Id (systemId) like this:
/salesAgreementHeaders(603a5b67-dacc-ee11-9078-000d3a64d7c6)/salesAgreementLines