Breadcrumbs

API - Sales Agreements

Overview

The list page that contains the sales agreements in Wisefish, which are mainly used as Delivery Agreements.

In this case there are 3 endpoints with same properties, but different filter or usage:

  1. All entries in the table, i.e. all Sales Agreement Header entries : salesAgreements

  2. Sales Agreements which are open for changes, because the posting document has not been created: openSalesAgreements

  3. Closed entries. i.e. non-editable, because the posting document has been created: closedAgreements

Endpoint names

salesAgreements

openSalesAgreements

closedAgreements

Source table

"WiFi Sales Agreement Header"

Fixed view

Only shows unposted sales, i.e. where invoice has not been posted.

Requests allowed

GET, POST, PATCH, DELETE - for openSalesAgreements

GET for salesAgreements and closedAgreements

Primary key

documentType, documentNo

Record ID

systemId

Child entry endpoint(s)

API - Sales Agreement Lines

Procedures

release, reopen, createPostingDocument, receiveItems

Data

Field List

1

Property

Type

Max Len

Description


2

systemId

string uuid


The record ID must be used when reading only one entry or when using procedures on the endpoint.

RECORD ID

3

documentType

string


Options are: Blanket, Delivery

Delivery is the default value when the property is skipped.

See Wisefish documentation to understand the difference.

Primary key

4

documentNo

string

20

The unique id within each documentType

This is the most commonly used reference for a sales document. It often starts with a “DA” to relate to a “Delivery Agreement”.

Primary key

5

orderDate

date



Mandatory

6

salesPersonCode

string

20

The sales person code.


7

externalDocumentNo

string

35

Use to make a reference to external documents, such as the customer order.


8

status

string


Options are: Open and Released.

Released documents are mostly un-editable. A procedure must be used to release a document.

non-editable 10

9

sellToCustomerNo

string

20

The number of the customer, this field has table relation to the Customer table.

Mandatory

10

sellToCustomerName

string

100

Customer info, default value from the Customer


11

sellToAddress

string

100

Customer info, default value from the Customer


12

sellToPostCode

string

20

Customer info, default value from the Customer


13

sellToCity

string

30

Customer info, default value from the Customer


14

sellToCountryRegion

string

10

Customer info, default value from the Customer


15

sellToContact

string

100

Customer info, default value from the Customer


16

yourReference

string

35



17

languageCode

string

10



18

locationCode

string

10

From which Location the items will be taken.


19

stockCenterCode

string

20

From which Stock Center the items will be taken.


20

transportMethodCode

string

10

Shipping info


21

shipmentMethod

string

10

Shipping info


22

shipmentDate

date


Shipping info


23

requestedDeliveryDate

date


Shipping info


24

placeOfLoading

string

10

Shipping info - linked to table WiFi UN/LOCODE


25

placeOfDischarge

string

10

Shipping info - linked to table WiFi UN/LOCODE


26

placeOfDelivery

string

10

Shipping info - linked to table WiFi UN/LOCODE


27

placeOfDestination

string

10

Shipping info - linked to table WiFi UN/LOCODE


28

shippingAgent

string

10

Shipping info - field “Shipping Agent Code”


29

shippingAgentService

string

10

Shipping info - field “Shipping Agent Service Code”


30

shippingReferenceNo

string

10

Shipping info


31

scheduledTripNo

string

20

The Scheduled Trip to use for this sales. Related to table “Scheduled Trip”.


32

transportUnitId

integer


If only a specific transport has been designated for this sales. Related to table “Transport Unit”


33

noOfTransportUnits

integer


Shows the number of transport units linked to the Scheduled Trip

non-editable

34

shipToCode

string

10

If the customer has multiple addresses, an address can be selected from that list and this field will contain the Code of that address entry in the Ship-to Address list.


35

shipToName

string

100

Ship-to information


36

shipToName2

string

50

Ship-to information


37

shipToAddress

string

100

Ship-to information


38

shipToAddress2

string

50

Ship-to information


39

shipToPostCode

string

20

Ship-to information


40

shipToCity

string

30

Ship-to information


41

shipToCounty

string


Ship-to information


42

shipToCountry

string

10

Ship-to information


43

shipToContact

string

100

Ship-to information


44

amount

decimal


The total amount of the order


45

currencyCode

string

10

Currency for the total amount


46

postingDate

date


On which posting date it will be posted.


47

billToCustomerNo

string

20

If should be billed to another customer, i.e. can be different from the sellToCustomerNo.


48

billToCountryRegion

string

10



49

paymentBankAccount

string

20



50

noOfLines

integer


No. of lines on this agreement. This will be the number of child entries in salesAgreementLines

non-editable

51

noOfTradeItems

integer


Total number of trade items to be sold.

non-editable

52

noOfTradeItemsReserved

integer


Total number of trade items already reserved.

non-editable

53

noOfTradeItemsShipped

integer


Total number of trade items already shipped.

non-editable

54

noOfPalletsReserved

integer


Total number of pallets reserved. Trade items do not necessarily belong to a pallet.

non-editable

55

lastModified

datetime


Automatic time stamp of last modification.

non-editable

Example Object

JSON
{
    "@odata.etag": "W/\"JzIwOzE0Njc0NjI1MTg3MTc1MjQzNTY1MTswMDsn\"",
    "systemId": "db17585a-4eab-f011-b028-e5231dc67468",
    "documentType": "Delivery",
    "documentNo": "DS-034",
    "orderDate": "2026-01-22",
    "externalDocumentNo": "",
    "status": "Open",
    "sellToCustomerNo": "01905899",
    "sellToCustomerName": "Elkhorn Airport",
    "sellToAddress": "105 Buffalo Dr.",
    "sellToPostCode": "CA-MB R0M 0N0",
    "sellToCity": "Elkhorn",
    "sellToCountryRegion": "CA",
    "sellToContact": "Mr. Ryan Danner",
    "yourReference": "",
    "languageCode": "ENC",
    "locationCode": "BLUE",
    "stockCenterCode": "OWN",
    "transportMethodCode": "",
    "shipmentMethod": "EXW",
    "shipmentDate": "2026-01-22",
    "requestedDeliveryDate": "2026-01-22",
    "placeOfLoading": "",
    "placeOfDischarge": "",
    "placeOfDelivery": "",
    "placeOfDestination": "",
    "shippingAgent": "",
    "shippingAgentService": "",
    "shippingReferenceNo": "",
    "scheduledTripNo": "",
    "transportUnitId": 0,
    "noOfTransportUnits": 0,
    "shipToCode": "",
    "shipToName": "Elkhorn Airport",
    "shipToName2": "",
    "shipToAddress": "105 Buffalo Dr.",
    "shipToAddress2": "",
    "shipToPostCode": "CA-MB R0M 0N0",
    "shipToCity": "Elkhorn",
    "shipToCounty": "",
    "shipToCountry": "CA",
    "shipToContact": "Mr. Ryan Danner",
    "amount": 31351.86,
    "currencyCode": "CAD",
    "postingDate": "2026-01-22",
    "billToCustomerNo": "01905899",
    "billToCountryRegion": "CA",
    "paymentBankAccount": "",
    "noOfLines": 0,
    "noOfTradeItems": 1706,
    "noOfTradeItemsReserved": 1726,
    "noOfTradeItemsShipped": 0,
    "noOfPalletsReserved": 12,
    "lastModified": "2025-10-29T11:55:38.107Z"
}

Usage

Read one agreement with lines

Reading one entry of this table must be done with the record Id which is in this case the systemId.

Lines are shown by adding to the URL $expand=salesAgreementLines

GET ... salesAgreements([system-id])?$expand=salesAgreementLines


Expand to see the example json

An example of a response:

JSON
GET ... salesAgreements(db17585a-4eab-f011-b028-e5231dc67468)?$expand=salesAgreementLines

{
    "@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#companies(cf9f7b85-dd11-ef11-9f8b-6045bde9cc61)/salesAgreements",
    "value": [
        {
            "@odata.etag": "W/\"JzIwOzE0Njc0NjI1MTg3MTc1MjQzNTY1MTswMDsn\"",
            "systemId": "db17585a-4eab-f011-b028-e5231dc67468",
            "documentType": "Delivery",
            "documentNo": "DS-034",
            "orderDate": "2026-01-22",
            "externalDocumentNo": "",
            "status": "Open",
            "sellToCustomerNo": "01905899",
            "sellToCustomerName": "Elkhorn Airport",
            "sellToAddress": "105 Buffalo Dr.",
            "sellToPostCode": "CA-MB R0M 0N0",
            "sellToCity": "Elkhorn",
            "sellToCountryRegion": "CA",
            "sellToContact": "Mr. Ryan Danner",
            "yourReference": "",
            "languageCode": "ENC",
            "locationCode": "BLUE",
            "stockCenterCode": "OWN",
            "transportMethodCode": "",
            "shipmentMethod": "EXW",
            "shipmentDate": "2026-01-22",
            "requestedDeliveryDate": "2026-01-22",
            "placeOfLoading": "",
            "placeOfDischarge": "",
            "placeOfDelivery": "",
            "placeOfDestination": "",
            "shippingAgent": "",
            "shippingAgentService": "",
            "shippingReferenceNo": "",
            "scheduledTripNo": "",
            "transportUnitId": 0,
            "noOfTransportUnits": 0,
            "shipToCode": "",
            "shipToName": "Elkhorn Airport",
            "shipToName2": "",
            "shipToAddress": "105 Buffalo Dr.",
            "shipToAddress2": "",
            "shipToPostCode": "CA-MB R0M 0N0",
            "shipToCity": "Elkhorn",
            "shipToCounty": "",
            "shipToCountry": "CA",
            "shipToContact": "Mr. Ryan Danner",
            "amount": 31351.86,
            "currencyCode": "CAD",
            "postingDate": "2026-01-22",
            "billToCustomerNo": "01905899",
            "billToCountryRegion": "CA",
            "paymentBankAccount": "",
            "noOfLines": 0,
            "noOfTradeItems": 1706,
            "noOfTradeItemsReserved": 1726,
            "noOfTradeItemsShipped": 0,
            "noOfPalletsReserved": 12,
            "lastModified": "2025-10-29T11:55:38.107Z",
            "salesAgreementLines": [
                {
                    "@odata.etag": "W/\"JzE5OzUzOTcwNzA0OTkxNTcwMDI1ODIxOzAwOyc=\"",
                    "systemId": "6cdaab72-80af-f011-b028-99c8bc4e8b83",
                    "documentType": "Delivery",
                    "documentNo": "DS-034",
                    "lineNo": 50000,
                    "type": "Item",
                    "itemNo": "70064",
                    "description": "Cod - raw material",
                    "locationCode": "BLUE",
                    "stockCenterCode": "",
                    "lotFilter": "",
                    "lotFilterOriginal": "",
                    "noOfTradeItems": 1100,
                    "tradeItemUnit": "KG",
                    "quantity": 1100,
                    "unitOfMeasureCode": "KG",
                    "quantityBase": 1100,
                    "noOfPallets": 4.4,
                    "unitPrice": 12,
                    "purchPriceToVendor": 0,
                    "lineAmount": 13200,
                    "lineDiscount": 0,
                    "lineDiscountAmount": 0,
                    "amount": 13200,
                    "vat": 0,
                    "amountIncludingVAT": 13200,
                    "vendorNo": "",
                    "externalProducer": "",
                    "netWeight": 1,
                    "netWeightBWU": 1100,
                    "lastModified": "2025-12-07T09:14:20.323Z"
                },
                {
                    "@odata.etag": "W/\"JzIwOzE0NTI4MDI2MDc2NzYyMzU0Mjc0MTswMDsn\"",
                    "systemId": "de661423-7eaf-f011-b028-99c8bc4e8b83",
                    "documentType": "Delivery",
                    "documentNo": "DS-034",
                    "lineNo": 40000,
                    "type": "Item",
                    "itemNo": "70065",
                    "description": "Fiskinaggar ",
                    "locationCode": "BLUE",
                    "stockCenterCode": "",
                    "lotFilter": "",
                    "lotFilterOriginal": "",
                    "noOfTradeItems": 60,
                    "tradeItemUnit": "PACK",
                    "quantity": 600,
                    "unitOfMeasureCode": "PCS",
                    "quantityBase": 600,
                    "noOfPallets": 0,
                    "unitPrice": 23.153,
                    "purchPriceToVendor": 0,
                    "lineAmount": 13891.8,
                    "lineDiscount": 0,
                    "lineDiscountAmount": 0,
                    "amount": 13891.8,
                    "vat": 0,
                    "amountIncludingVAT": 13891.8,
                    "vendorNo": "",
                    "externalProducer": "",
                    "netWeight": 5,
                    "netWeightBWU": 3000,
                    "lastModified": "2025-10-28T09:30:22.037Z"
                },
                {
                    "@odata.etag": "W/\"JzIwOzEzMDk3OTUxNTU1NTc2NTExMzM4MTswMDsn\"",
                    "systemId": "ee6619e4-66af-f011-b028-99c8bc4e8b83",
                    "documentType": "Delivery",
                    "documentNo": "DS-034",
                    "lineNo": 30000,
                    "type": "Item",
                    "itemNo": "0900",
                    "description": "Þorskflök",
                    "locationCode": "BLUE",
                    "stockCenterCode": "",
                    "lotFilter": "",
                    "lotFilterOriginal": "",
                    "noOfTradeItems": 0,
                    "tradeItemUnit": "BOX",
                    "quantity": 0,
                    "unitOfMeasureCode": "KG",
                    "quantityBase": 0,
                    "noOfPallets": 0,
                    "unitPrice": 17.365,
                    "purchPriceToVendor": 0,
                    "lineAmount": 0,
                    "lineDiscount": 0,
                    "lineDiscountAmount": 0,
                    "amount": 0,
                    "vat": 0,
                    "amountIncludingVAT": 0,
                    "vendorNo": "",
                    "externalProducer": "",
                    "netWeight": 1,
                    "netWeightBWU": 0,
                    "lastModified": "2025-10-28T09:30:22.033Z"
                },
                {
                    "@odata.etag": "W/\"JzE5Ozk1MDA1MzM4ODI5MTk0NTk3NzQxOzAwOyc=\"",
                    "systemId": "dcdc0f4c-a1ad-f011-b028-a35a9231a4e1",
                    "documentType": "Delivery",
                    "documentNo": "DS-034",
                    "lineNo": 20000,
                    "type": "Item",
                    "itemNo": "70079",
                    "description": "Cod fillets (3 kg box)",
                    "locationCode": "BLUE",
                    "stockCenterCode": "",
                    "lotFilter": "",
                    "lotFilterOriginal": "",
                    "noOfTradeItems": 86,
                    "tradeItemUnit": "BOX",
                    "quantity": 86,
                    "unitOfMeasureCode": "BOX",
                    "quantityBase": 258,
                    "noOfPallets": 3.58333333333333333,
                    "unitPrice": 0,
                    "purchPriceToVendor": 0,
                    "lineAmount": 0,
                    "lineDiscount": 0,
                    "lineDiscountAmount": 0,
                    "amount": 0,
                    "vat": 0,
                    "amountIncludingVAT": 0,
                    "vendorNo": "",
                    "externalProducer": "",
                    "netWeight": 3,
                    "netWeightBWU": 258,
                    "lastModified": "2025-10-29T13:57:59.087Z"
                },
                {
                    "@odata.etag": "W/\"JzE5OzQ1ODI2MDIxNDExNjU2NzQ1NDAxOzAwOyc=\"",
                    "systemId": "03591d61-4eab-f011-b028-e5231dc67468",
                    "documentType": "Delivery",
                    "documentNo": "DS-034",
                    "lineNo": 10000,
                    "type": "Item",
                    "itemNo": "70066",
                    "description": "Fish junk (fiskimauk í nagga)",
                    "locationCode": "BLUE",
                    "stockCenterCode": "",
                    "lotFilter": "",
                    "lotFilterOriginal": "",
                    "noOfTradeItems": 460,
                    "tradeItemUnit": "KG",
                    "quantity": 460,
                    "unitOfMeasureCode": "KG",
                    "quantityBase": 460,
                    "noOfPallets": 1.84,
                    "unitPrice": 9.261,
                    "purchPriceToVendor": 0,
                    "lineAmount": 4260.06,
                    "lineDiscount": 0,
                    "lineDiscountAmount": 0,
                    "amount": 4260.06,
                    "vat": 0,
                    "amountIncludingVAT": 4260.06,
                    "vendorNo": "",
                    "externalProducer": "",
                    "netWeight": 1,
                    "netWeightBWU": 460,
                    "lastModified": "2025-10-20T10:41:05.663Z"
                }
            ]
        }
    ]
}

Create an agreement with lines

JSON
POST .../openSalesAgreements?$expand=salesAgreementLines

Body:

{
    "orderDate": "2025-12-07",
    "sellToCustomerNo": "4203690429",
    "locationCode": "001",
    "externalDocumentNo": "ORD-0123",
    "salesAgreementLines": [
        {
            "itemNo": "ZZZ1003",
            "tradeItems": 2,
            "tradeItemUnitOfMeasure": "kassi"
        }
    ]
}

The response contains the the new entry, both header and lines.


Procedures

Service-enabled procedures are the following, see below.

Only the open sales agreements have procedures.

In general, if the request is successful, the response is 200 OK and could also possibly contain something in the value property:

JSON
{
    "@odata.context": "https://api.businesscentral.dynamics.com/v2.0/b33a6a3b-244c-4295-84b3-0ad90823c736/AB_Test_191125/api/wisefish/base/v1.0/$metadata#Edm.String",
    "value": "Success"
}


Release

This will release the agreement, same as clicking on the Release button within BC.

Usage

JSON
POST
[server]/api/wisefish/wiFiEP/v1.0/companies([CompanyGUID])/openSalesAgreements([record-id])/Microsoft.NAV.release

(no parameters)

After a successful request:

  • The Status becomes Released.


Reopen

If an already released agreement needs to be reopened, in order to do some changes.

Usage

JSON
POST
[server]/api/wisefish/wiFiEP/v1.0/companies([CompanyGUID])/openSalesAgreements([record-id])/Microsoft.NAV.reopen

(no parameters)

After a successful request:

  • The Status becomes Open.


Create Posting Document

When all lines have been registered on the sales agreement, the posting document can be created, i.e. either a Sales Order or a Sales Invoice. Before this is run, the agreement must be released.

Usage

JSON
POST
[server]/api/wisefish/wiFiEP/v1.0/companies([CompanyGUID])
  /openSalesAgreements([record-id])/Microsoft.NAV.createPostingDocument

(no parameters)

After a successful request:

  • A standard BC posting document (Sales Order or Sales Invoice, depends on settings) has been created for the agreement.


Create Posting Document and Post Shipment

This method can be used if the API user is allowed to both create the posting document and then immediately post the items out of inventory.

Usage

JSON
POST
[server]/api/wisefish/wiFiEP/v1.0/companies([CompanyGUID])
  /openSalesAgreements([record-id])/Microsoft.NAV.createPostingDocumentAndPostShipment

(no parameters)

This method does both:

  • Creates a a Sales Order for the agreement.

  • The sales order is posted with the “Ship” option, which means that items are removed from stock, but the order waits for the invoice to be created later.