Overview
The table behind this API page is the one that contains the sales agreements in Wisefish, often called “Sales Orders” but are not the same as the Sales Orders in standard Business Central. The sales agreements are mainly used as Delivery Agreements. The endpoint also contains Blanket Sales Agreements.
There are 3 endpoints with same properties, but a different fixed filter on Status and can give access to different procedures:
-
Endpoint
salesAgreementsshows both open and posted agreements. -
Agreements which are open for changes, because the posting document has not been created:
openSalesAgreements -
Closed agreements. These are non-editable, because the posting document has been created:
closedSalesAgreements
|
Endpoint names |
|
|
Source table |
|
|
Fixed view |
All three endpoints are sorted by |
|
Requests allowed |
GET, POST, PATCH, DELETE - for GET for |
|
Primary key |
|
|
Record ID |
|
|
Child objects |
Available with
|
|
Procedures |
Not available (there is no such procedure in the code): |
The three endpoints do not have exactly the same property list: shippingReferenceType and invoicingStatus are only on salesAgreements, and noOfTradeItemsReserved and noOfPalletsReserved are not on closedSalesAgreements. On closedSalesAgreements the lines (salesAgreementLines) are read-only. See the Field List below.
Data
Field List
The tags show which properties can be given in POST and PATCH requests on salesAgreements and openSalesAgreements. On closedSalesAgreements (GET only) all properties are read-only.
|
1 |
Property |
Type |
Format |
Description |
|
|
2 |
|
string |
uuid |
The record ID must be used when reading only one entry or when using procedures on the endpoint. |
Record ID non-editable |
|
3 |
|
string |
enum |
Options are: Blanket, Delivery Delivery is the default value when the property is skipped. See Wisefish documentation to understand the difference. |
primary key optional |
|
4 |
|
string |
max 20 |
The unique id within each 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 non-editable |
|
5 |
|
string |
date |
Order date, will be set by default but can be changed. |
optional |
|
6 |
|
string |
max 20 |
The salesperson code. |
optional |
|
7 |
|
string |
max 35 |
Use to make a reference to external documents, such as the customer order. |
optional |
|
8 |
|
string |
enum |
Options: Open, Released, Pending Approval, Pending Prepayment, Proforma, Posting, Closed, Fully Delivered, Partly Delivered, Cancelled, Rejected, Pending Acceptance, Accepted. In JSON a space in the value is written as Released documents are mostly un-editable. A procedure must be used to release a document. |
non-editable |
|
9 |
|
string |
max 20 |
The number of the customer, this field has table relation to the Customer table. |
mandatory |
|
10 |
|
string |
max 100 |
Customer info, default value from the Customer |
optional |
|
11 |
|
string |
max 100 |
Customer info, default value from the Customer |
optional |
|
12 |
|
string |
max 20 |
Customer info, default value from the Customer |
optional |
|
13 |
|
string |
max 30 |
Customer info, default value from the Customer |
optional |
|
14 |
|
string |
max 10 |
Customer info, default value from the Customer |
optional |
|
15 |
|
string |
max 100 |
Customer info, default value from the Customer |
optional |
|
16 |
|
string |
max 35 |
Field used for some info that is relevant for the customer. |
optional |
|
17 |
|
string |
max 10 |
The language code of the customer. This can in some cases affect the language of printed documents. |
optional |
|
18 |
|
string |
max 10 |
From which Location the items will be taken. |
optional |
|
19 |
|
string |
max 20 |
From which Stock Center the items will be taken. |
optional |
|
20 |
|
string |
max 10 |
Shipping info |
optional |
|
21 |
|
string |
max 10 |
Shipping info |
optional |
|
22 |
|
string |
date |
Shipping info |
optional |
|
23 |
|
string |
date |
Shipping info |
optional |
|
24 |
|
string |
max 10 |
Shipping info - linked to table |
optional |
|
25 |
|
string |
max 10 |
Shipping info - linked to table |
optional |
|
26 |
|
string |
max 10 |
Shipping info - linked to table |
optional |
|
27 |
|
string |
max 10 |
Shipping info - linked to table |
optional |
|
28 |
|
string |
max 10 |
Shipping info - field “Shipping Agent Code” |
optional |
|
29 |
|
string |
max 10 |
Shipping info - field “Shipping Agent Service Code” Note: on |
optional |
|
30 |
|
string |
enum |
Shipping Reference Type. Options: (blank), AWB (Airway Bill), CONNOTE (Consignment Note). Only on |
optional |
|
31 |
|
string |
max 20 |
Shipping info |
optional |
|
32 |
|
string |
max 20 |
The Scheduled Trip to use for this sales. Related to table “Scheduled Trip”. |
optional |
|
33 |
|
number |
integer |
If only a specific transport has been designated for this sales. Related to table “Transport Unit” |
optional |
|
34 |
|
number |
integer |
Shows the number of transport units linked to the Scheduled Trip |
non-editable |
|
35 |
|
string |
max 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. |
optional |
|
36 |
|
string |
max 100 |
Ship-to information |
optional |
|
37 |
|
string |
max 50 |
Ship-to information |
optional |
|
38 |
|
string |
max 100 |
Ship-to information |
optional |
|
39 |
|
string |
max 50 |
Ship-to information |
optional |
|
40 |
|
string |
max 20 |
Ship-to information |
optional |
|
41 |
|
string |
max 30 |
Ship-to information |
optional |
|
42 |
|
string |
max 30 |
Ship-to information |
optional |
|
43 |
|
string |
max 10 |
Ship-to information |
optional |
|
44 |
|
string |
max 100 |
Ship-to information |
optional |
|
45 |
|
number |
decimal |
The total amount of the order |
non-editable |
|
46 |
|
string |
max 10 |
Currency for the total amount |
optional |
|
47 |
|
string |
date |
On which posting date it will be posted. |
optional |
|
48 |
|
string |
max 20 |
If should be billed to another customer, i.e. can be different from the sellToCustomerNo. |
optional |
|
49 |
|
string |
max 10 |
Country or region. |
optional |
|
50 |
|
string |
max 20 |
Payment bank account, this can be set as mandatory with a setting. |
optional |
|
51 |
|
string |
|
Invoicing and Documentation Status, returned as text: the option caption (e.g. “Ready for Invoicing and Documentation”) in the language of the API user. Can only be changed with the procedure Only on |
non-editable |
|
52 |
|
number |
integer |
No. of lines on this agreement. This will be the number of child entries in |
non-editable |
|
53 |
|
number |
decimal |
Total number of trade items to be sold. |
non-editable |
|
54 |
|
number |
decimal |
Total number of trade items already reserved. Not on |
non-editable |
|
55 |
|
number |
decimal |
Total number of trade items already shipped. |
non-editable |
|
56 |
|
number |
integer |
Total number of pallets reserved. Trade items do not necessarily belong to a pallet. Not on |
non-editable |
|
57 |
|
array |
json |
The lines of the agreement. Can be added as a child array with |
|
|
58 |
|
array |
json |
Array of object |
|
|
59 |
|
number |
integer |
System row version. Increments every time the record is modified. |
non-editable |
|
60 |
|
string |
date-time |
SystemModifiedAt (date and time of last change) |
non-editable |
|
61 |
|
string |
max 50 |
The user who last modified the record |
non-editable |
Object Example
{
"systemId": "db17585a-4eab-f011-b028-e5231dc67468",
"documentType": "Delivery",
"documentNo": "DS-034",
"orderDate": "2026-01-22",
"salesPersonCode": "JR",
"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": "",
"shippingReferenceType": "_x0020_",
"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": "",
"invoicingStatus": "Unavailable for Invoicing and Documentation",
"noOfLines": 0,
"noOfTradeItems": 1706,
"noOfTradeItemsReserved": 1726,
"noOfTradeItemsShipped": 0,
"noOfPalletsReserved": 12,
"systemRowVersion": 2583127,
"lastModified": "2025-10-29T11:55:38.107Z",
"modifiedByUser": ""
}
Extended Texts
The child array extendedTexts (object extendedText, page WiFiAPIs ExtendedText) contains the extended texts of the agreement, from table WiFi Document Ext. Text. It has no page of its own in this space and is only available with $expand=extendedTexts on all three endpoints. Extended texts can be added and changed, but not deleted (DeleteAllowed = false).
The link to the agreement is only on documentNo (not on the document type), so extended texts of other document types with the same document no. are also shown.
|
Property |
Type |
Format |
Description |
|
|---|---|---|---|---|
|
|
string |
uuid |
SystemId. The Record ID of the extended text. |
Record ID non-editable |
|
|
string |
enum |
Document Type. Options: Delivery_x0020_Agreement, Purchase_x0020_Agreement, Sales_x0020_Order, Sales_x0020_Invoice, Posted_x0020_Sales_x0020_Invoice, Purchase_x0020_Order, Purchase_x0020_Invoice, Posted_x0020_Purchase_x0020_Invoice, Export, Sales_x0020_Cr._x0020_Memo, Posted_x0020_Sales_x0020_Cr._x0020_Memo, Purchase_x0020_Cr._x0020_Memo, Posted_x0020_Purchase_x0020_Cr._x0020_Memo, Quote_x0020_Sales_x0020_Agreement, Quote_x0020_Purchase_x0020_Agreement. For a sales agreement it is Delivery_x0020_Agreement (the default). |
primary key optional |
|
|
string |
max 20 |
Document No. (the |
primary key optional |
|
|
number |
integer |
Line No. |
primary key optional |
|
|
string |
max 100 |
Extended Text |
optional |
|
|
boolean |
|
Concatenate Line (field 8, caption “Concatenate Lines”) |
optional |
|
|
boolean |
|
Concatenate Lines (field 7) |
optional |
|
|
number |
integer |
System row version. Increments every time the record is modified. |
non-editable |
|
|
string |
date-time |
SystemModifiedAt (date and time of last change) |
non-editable |
|
|
string |
max 50 |
The user who last modified the record |
non-editable |
PDF Document
The code of closedSalesAgreements contains a child object pdfDocument (page WiFiXX PDF Document, one PDF document per agreement, linked on the systemId of the agreement), but it is commented out, so pdfDocument is not available on any of the endpoints and $expand=pdfDocument returns an error. The page WiFiXX PDF Document does not exist in the Wisefish APIs code.
Procedures
-
Only the open sales agreements can be changed, so if trying to run some procedures on closed agreements an error will be returned which is correct.
-
The record Id of the entry must be known in order to use procedures
-
The URL will be:
[server]/api/wisefish/base/v1.0/companies([CompanyGUID])/openSalesAgreements([record-id])/Microsoft.NAV.[procedureName] -
Procedures are available on
salesAgreementsandopenSalesAgreements. The endpointclosedSalesAgreementshas no procedures.
In general, if the request is successful, the response is 200 OK and could also possibly contain something in the value property:
{
"@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"
}
Procedure names and parameter names are case-sensitive (e.g. reOpen, AddNote). Each procedure returns a text message in the value property of the response on success. On failure it returns an error with a readable message.
|
Procedure |
Parameters |
Description |
Details |
|---|---|---|---|
|
|
none |
Release the agreement, same as the Release button in Business Central. Also on |
|
|
|
none |
Reopen a released agreement so it can be changed. Also on |
|
|
|
none |
Create the posting document (Sales Order or Sales Invoice) for the agreement. Also on |
|
|
|
none |
Set the quantity of all item lines to the reserved quantity. Also on |
|
|
|
none |
Create a Sales Order for the agreement and post it. Also on |
|
|
|
none |
Set the invoicing status of a released agreement to Ready. Only on |
|
|
|
|
Add a note to the agreement. The note is registered as from the API user. Only on |
|
|
|
|
Add a note to the agreement, registered as from the given Business Central user. The user must exist in User Setup. Only on |
Procedures on salesAgreements
All procedures below are available on salesAgreements. The ones that are also available on openSalesAgreements are marked so in the table above. The URLs may use either of the two endpoints.
Release
This will release the agreement, same as clicking on the Release button within BC.
POST
[server]/api/wisefish/base/v1.0/companies([CompanyGUID])/openSalesAgreements([record-id])/Microsoft.NAV.release
(no parameters)
After a successful request:
-
The Status becomes Released.
The value property of the response is Agreement has been released.
Possible errors:
-
The agreement does not exist (standard Business Central error, record not found).
-
The status of the agreement is not Open (standard Business Central error from
TestField: Status must be equal to Open). -
Errors from the Wisefish release of the agreement, i.e. the same checks as when the agreement is released in Business Central.
Reopen
If an already released agreement needs to be reopened, in order to do some changes.
POST
[server]/api/wisefish/base/v1.0/companies([CompanyGUID])/openSalesAgreements([record-id])/Microsoft.NAV.reOpen
(no parameters)
After a successful request:
-
The Status becomes Open.
The value property of the response is Agreement has been reopened.
Possible errors:
-
The agreement does not exist (standard Business Central error, record not found).
-
The status of the agreement is not Released (standard Business Central error from
TestField: Status must be equal to Released). -
Errors from the Wisefish reopening of the agreement.
Behaviour notes:
-
The procedure name is
reOpen(capital O).Microsoft.NAV.reopenis not found.
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.
POST
[server]/api/wisefish/base/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.
The value property of the response is Sales document <Document Type> <No.> created..
Possible errors:
-
The agreement does not exist (standard Business Central error, record not found).
-
Sales document was not created(when no sales document was created, e.g. when the field Sales Document Type on the agreement is not Order or Invoice) -
Errors from the Wisefish creation of the sales document.
Behaviour notes:
-
The field Sales Document Type on the agreement decides which document is created: Order creates a Sales Order, Invoice creates a Sales Invoice.
-
The API code does not check the status of the agreement before calling Wisefish; status requirements come from the Wisefish document creation.
-
The <Document Type> in the response is the caption of the document type (e.g. Order) in the language of the API user.
Set Quantity as Reserved
Sets the quantity on all item lines of the agreement to the quantity that has been reserved, e.g. after pallets or trade items have been reserved to the agreement.
POST
.../salesAgreements([record-id])/Microsoft.NAV.setQuantityAsReserved
(no parameters)
After a successful request:
-
The quantity on every line of type Item (with an item no.) has been synchronized to the reserved quantity.
The value property of the response is Quantity in all lines has been set the same as reserved quantity..
Possible errors:
-
The agreement does not exist (standard Business Central error, record not found).
-
Cannot modify quantity for a closed sales agreement!(when the status is Closed; this can only happen onsalesAgreements) -
Errors from the Wisefish synchronization of the line quantity, or from modifying the lines.
Behaviour notes:
-
If the agreement is Released, the status is set to Open while the lines are changed and back to Released afterwards. This is done directly on the status field, the Wisefish release/reopen logic is not run.
-
Lines of other types than Item, and lines without an item no., are skipped.
-
Only the status Closed is rejected; agreements with status Posting are not blocked by the API code.
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.
POST
[server]/api/wisefish/base/v1.0/companies([CompanyGUID])
/openSalesAgreements([record-id])/Microsoft.NAV.createPostingDocumentAndPostShipment
(no parameters)
This method does both:
-
Creates a Sales Order for the agreement.
-
The sales order is posted with both the “Ship” and the “Invoice” options, which means that items are removed from stock and the invoice is posted at the same time.
The value property of the response is Sales order <No.> created and shipment posted successfully..
Possible errors:
-
The agreement does not exist (standard Business Central error, record not found).
-
Sales document was not created(when no sales document was created) -
This function only supports Sales Orders!(when the field Sales Document Type on the agreement is Invoice, i.e. a Sales Invoice would be created) -
Errors from the Wisefish creation of the sales document.
-
Errors from the standard Business Central posting of the sales order (Sales-Post).
Behaviour notes:
-
The whole request is one transaction: if an error occurs, nothing is created or posted (the created sales document is rolled back).
-
The <No.> in the response is the number of the sales order that was created and posted.
Set Ready to Be Invoiced
Sets the invoicing status (invoicingStatus) of a released agreement to Ready. This must be done after the agreement has been released. Only available on salesAgreements.
POST
.../salesAgreements([record-id])/Microsoft.NAV.setReadyToBeInvoiced
(no parameters)
After a successful request:
-
The Invoicing Status becomes Ready (
invoicingStatusshows “Ready for Invoicing and Documentation”).
The value property of the response is Invoicing status set to Ready.
Possible errors:
-
The agreement does not exist (standard Business Central error, record not found).
-
The status of the agreement is not Released (standard Business Central error from
TestField: Status must be equal to Released).
Behaviour notes:
-
The current invoicing status is not checked, the status is set to Ready whatever it was before.
-
The field is changed directly, without running the validation or modify triggers.
Add Note
The procedure AddNote adds a note to the sales agreement. The note is a Business Central Note record link with the description “Sent through API”, and it is registered as from the API user (the user making the call). Only available on salesAgreements.
POST
.../salesAgreements([record-id])/Microsoft.NAV.AddNote
Body:
{
"noteText": [the text of the note]
}
|
Parameters |
Type |
Max Len |
Description |
|
|---|---|---|---|---|
|
|
string |
250 |
The text of the note. |
mandatory |
A note is added to the sales agreement, and the value property of the response is Note successfully added.
Possible errors:
-
The agreement does not exist (standard Business Central error, record not found).
-
noteTextis longer than 250 characters (standard Business Central error, the text exceeds the parameter length).
Behaviour notes:
-
The note text is not validated: an empty
noteTextis not rejected, an empty note is added. -
The note is a Note type record link with the description “Sent through API”, created with the current date and time.
Notes can be read with the Record Notes API, see API - Record Notes in this space.
Add Note from a User
The procedure AddNoteFromUser works the same way as AddNote, but the note is registered as from the given Business Central user instead of the API user. Only available on salesAgreements.
POST
.../salesAgreements([record-id])/Microsoft.NAV.AddNoteFromUser
Body:
{
"noteText": [the text of the note],
"fromUser": [the BC user ID the note is registered from]
}
|
Parameters |
Type |
Max Len |
Description |
|
|---|---|---|---|---|
|
|
string |
250 |
The text of the note. |
mandatory |
|
|
string |
50 |
The BC user ID the note is registered from. The user must exist in User Setup, otherwise the call fails with the error “User with ID X does not exist”. |
mandatory |
A note is added to the sales agreement, and the value property of the response is Note successfully added and registered from user <fromUser>.
Possible errors:
-
The agreement does not exist (standard Business Central error, record not found).
-
A parameter is longer than its maximum length (standard Business Central error, the text exceeds the parameter length).
-
User with ID <fromUser> does not exist(whenfromUseris not found in User Setup)
Behaviour notes:
-
fromUseris a code parameter, so the value is converted to upper case:"john"is registered and returned asJOHN. -
If
fromUseris empty, no user check is made and the note is registered as from the API user (same asAddNote), but the response text then ends with an empty user ID:Note successfully added and registered from user. -
The note text is not validated: an empty
noteTextis not rejected.
Procedures on openSalesAgreements
The endpoint openSalesAgreements has the procedures release, reOpen, setQuantityAsReserved, createPostingDocument and createPostingDocumentAndPostShipment. They run exactly the same code as on salesAgreements, see Release, Reopen, Set Quantity as Reserved, Create Posting Document and Create Posting Document and Post Shipment above. Only the endpoint in the URL differs:
POST
[server]/api/wisefish/base/v1.0/companies([CompanyGUID])/openSalesAgreements([record-id])/Microsoft.NAV.[procedureName]
Because of the fixed filter on Status, the procedures can only be called on agreements with the status Open, Released, Partly Delivered or Fully Delivered; other agreements are not found. setReadyToBeInvoiced, AddNote and AddNoteFromUser are not available on this endpoint.
Procedures on closedSalesAgreements
The endpoint closedSalesAgreements is read-only and has no procedures.
Examples
Read sales agreements
Read the open agreements of a customer
Reads all open agreements (status Open, Released, Partly Delivered or Fully Delivered) for customer 01905899. The response is a list of agreement objects, as shown in Object Example.
GET .../openSalesAgreements?$filter=sellToCustomerNo eq '01905899'
Read released agreements with selected properties
Reads the released agreements, and returns only a few properties with $select.
Request:
GET .../salesAgreements?$filter=status eq 'Released'&$select=documentNo,sellToCustomerNo,shipmentDate,amount
Response:
{
"@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#companies(cf9f7b85-dd11-ef11-9f8b-6045bde9cc61)/salesAgreements(documentNo,sellToCustomerNo,shipmentDate,amount)",
"value": [
{
"@odata.etag": "W/\"JzIwOzE0Njc0NjI1MTg3MTc1MjQzNTY1MTswMDsn\"",
"documentNo": "DS-035",
"sellToCustomerNo": "01905899",
"shipmentDate": "2026-01-29",
"amount": 18240.5
}
]
}
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
Read an agreement with its extended texts
Adds the extended texts of agreement DS-034 to the response with $expand=extendedTexts (the agreement properties are shortened here).
Request:
GET .../salesAgreements(db17585a-4eab-f011-b028-e5231dc67468)?$expand=extendedTexts
Response (shortened):
{
"@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#companies(cf9f7b85-dd11-ef11-9f8b-6045bde9cc61)/salesAgreements(extendedTexts())/$entity",
"systemId": "db17585a-4eab-f011-b028-e5231dc67468",
"documentType": "Delivery",
"documentNo": "DS-034",
"extendedTexts": [
{
"@odata.etag": "W/\"JzE5OzEyMzQ1Njc4OTAxMjM0NTY3ODkwOzAwOyc=\"",
"systemId": "5e0c7a21-4fb0-f011-b028-99c8bc4e8b83",
"documentType": "Delivery_x0020_Agreement",
"documentNo": "DS-034",
"lineNo": 10000,
"extendedText": "Deliver to gate 4, call before arrival",
"concatenateLine": false,
"concatenateLines": false,
"systemRowVersion": 2583140,
"lastModified": "2025-10-29T12:02:11.250Z",
"modifiedByUser": ""
}
]
}
Read closed agreements
Reads the closed agreements (status Posting or Closed) with posting date from 1 January 2026.
GET .../closedSalesAgreements?$filter=postingDate ge 2026-01-01
Create, change and delete agreements
Create an agreement with lines
POST .../openSalesAgreements?$expand=salesAgreementLines
Body:
{
"orderDate": "2025-12-07",
"sellToCustomerNo": "4203690429",
"locationCode": "001",
"externalDocumentNo": "ORD-0123",
"salesAgreementLines": [
{
"itemNo": "ZZZ1003",
"noOfTradeItems": 2,
"tradeItemUnitOfMeasure": "kassi",
"unitPrice": 10.0
}
]
}
The response contains the new entry, both header and lines.
Change an agreement
Changes the external document no. and the requested delivery date of agreement DS-034. A PATCH request needs the If-Match header with the @odata.etag of the record (or *).
Request:
PATCH .../openSalesAgreements(db17585a-4eab-f011-b028-e5231dc67468)
If-Match: *
Body:
{
"externalDocumentNo": "ORD-0124",
"requestedDeliveryDate": "2026-01-25"
}
Response (shortened):
{
"@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#companies(cf9f7b85-dd11-ef11-9f8b-6045bde9cc61)/openSalesAgreements/$entity",
"@odata.etag": "W/\"JzIwOzE1MDE4MjM0NTY3ODkwMTIzNDU2MTswMDsn\"",
"systemId": "db17585a-4eab-f011-b028-e5231dc67468",
"documentType": "Delivery",
"documentNo": "DS-034",
"externalDocumentNo": "ORD-0124",
"status": "Open",
"requestedDeliveryDate": "2026-01-25",
"systemRowVersion": 2583201,
"lastModified": "2025-10-30T08:14:52.410Z",
"modifiedByUser": ""
}
Delete an agreement
Deletes agreement DS-034. The same checks apply as when an agreement is deleted in Business Central. On success the response is empty (HTTP status 204 No Content).
DELETE .../openSalesAgreements(db17585a-4eab-f011-b028-e5231dc67468)
Change the status
Release an agreement
Releases agreement DS-034 using release.
Request:
POST
.../openSalesAgreements(db17585a-4eab-f011-b028-e5231dc67468)/Microsoft.NAV.release
(no parameters)
Response:
{
"@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#Edm.String",
"value": "Agreement has been released"
}
Reopen an agreement
Reopens the released agreement DS-034 using reOpen.
Request:
POST
.../openSalesAgreements(db17585a-4eab-f011-b028-e5231dc67468)/Microsoft.NAV.reOpen
(no parameters)
Response:
{
"@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#Edm.String",
"value": "Agreement has been reopened"
}
Set an agreement ready to be invoiced
Sets the invoicing status of the released agreement DS-034 to Ready using setReadyToBeInvoiced (only on salesAgreements).
Request:
POST
.../salesAgreements(db17585a-4eab-f011-b028-e5231dc67468)/Microsoft.NAV.setReadyToBeInvoiced
(no parameters)
Response:
{
"@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#Edm.String",
"value": "Invoicing status set to Ready"
}
Release an agreement that is already released
Calls release on an agreement that is already released; the call fails (the error message is shortened).
Response:
{
"error": {
"code": "Internal_TestFieldError",
"message": "Status must be equal to 'Open' in Sales Agreement Header: Document Type=Delivery, No.=DS-034. Current value is 'Released'."
}
}
Reservation and posting
Set the quantity of all lines as reserved
Sets the quantity on all item lines of agreement DS-034 to the reserved quantity using setQuantityAsReserved.
Request:
POST
.../openSalesAgreements(db17585a-4eab-f011-b028-e5231dc67468)/Microsoft.NAV.setQuantityAsReserved
(no parameters)
Response:
{
"@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#Edm.String",
"value": "Quantity in all lines has been set the same as reserved quantity."
}
Create the posting document for an agreement
Creates the posting document for the released agreement DS-034 using createPostingDocument; here the agreement creates a Sales Order.
Request:
POST
.../openSalesAgreements(db17585a-4eab-f011-b028-e5231dc67468)/Microsoft.NAV.createPostingDocument
(no parameters)
Response:
{
"@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#Edm.String",
"value": "Sales document Order 101005 created."
}
Create the sales order and post it
Creates a Sales Order for agreement DS-034 and posts it using createPostingDocumentAndPostShipment.
Request:
POST
.../openSalesAgreements(db17585a-4eab-f011-b028-e5231dc67468)/Microsoft.NAV.createPostingDocumentAndPostShipment
(no parameters)
Response:
{
"@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#Edm.String",
"value": "Sales order 101006 created and shipment posted successfully."
}
Add notes
Add a Note to a Sales Agreement
Adds the note “Customer asked for early delivery” to agreement DS-034 with AddNote; the note is registered as from the API user.
Request:
POST
.../salesAgreements(db17585a-4eab-f011-b028-e5231dc67468)/Microsoft.NAV.AddNote
{
"noteText": "Customer asked for early delivery"
}
Response:
{
"@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#Edm.String",
"value": "Note successfully added"
}
Add a Note to a Sales Agreement from a specific User
Adds the same note to agreement DS-034 with AddNoteFromUser, registered as from user JOHN.
Request:
POST
.../salesAgreements(db17585a-4eab-f011-b028-e5231dc67468)/Microsoft.NAV.AddNoteFromUser
{
"noteText": "Customer asked for early delivery",
"fromUser": "JOHN"
}
Response:
{
"@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#Edm.String",
"value": "Note successfully added and registered from user JOHN"
}