API - Purchase Agreements


Overview

The table behind this API page is the one that contains the purchase agreements in Wisefish, which are mainly used as Receipt Agreements, but the endpoint also contains Blanket Purchase Agreements.

There are 3 endpoints with same properties, but a different fixed filter on Status and can give access to different procedures:

  1. Endpoint purchaseAgreements shows both open and posted agreements.

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

  3. Closed agreements. these are non-editable, because the posting document has been created: closedPurchaseAgreements

Endpoint names

purchaseAgreements
openPurchaseAgreements
closedPurchaseAgreements

Source table

"WiFi Purchase Agreement Header"

Fixed view

Document Type = Blanket, Receipt

openPurchaseAgreements: also Status = Open, Released, Partly Received, Fully Received

closedPurchaseAgreements: also Status = Posting, Closed

All three endpoints are sorted by No. in descending order.

Requests allowed

purchaseAgreements, openPurchaseAgreements: GET, POST, PATCH, DELETE

closedPurchaseAgreements: GET only (the endpoint is read-only)

Primary key

documentType, documentNo

Record ID

systemId

Child objects

purchaseAgreementLines (with $expand=purchaseAgreementLines), see API - Purchase Agreement Lines

Procedures

purchaseAgreements: release, reOpen, createPostingDocument, receiveItems, AddNote, AddNoteFromUser

openPurchaseAgreements: release, reOpen, createPostingDocument, receiveItems

closedPurchaseAgreements: none

The three endpoints do not have exactly the same property list: on openPurchaseAgreements and closedPurchaseAgreements the property status comes after vendorOrderNo, stockCenterCode comes before locationCode, and instead of transportMethodCode they have shipmentMethodCode and shippingReferenceNo. See the Field List below.

The agreement lines are documented on their own page: API - Purchase Agreement Lines


Data

Field List

The tags show which properties can be given in POST and PATCH requests on purchaseAgreements and openPurchaseAgreements. On closedPurchaseAgreements (GET only) all properties are read-only.

Property

Type

Format

Description


1

systemId

string

uuid

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

Record ID

non-editable

2

documentType

string

enum

The type of agreement. Options:

  • Receipt - a normal purchase

  • Blanket - an ongoing purchase document.

If not given when adding a new agreement, the default is Receipt. See Wisefish user manuals for more info.

primary key

optional

3

documentNo

string

max 20

The unique id within each “Document Type”

primary key

optional

4

status

string

enum

Status shows if the agreement is still open or has been released. The status can only be modified with a procedure, see below.

Options: Open, Released, Posting, Closed, Fully Received, Partly Received, Cancelled, Rejected.

non-editable

5

orderDate

string

date

Order Date

optional

6

vendorOrderNo

string

max 35

Vendor Order No.

optional

7

buyFromVendorNo

string

max 20

This field is related to table Vendor.

mandatory

8

buyFromVendorName

string

max 100

Vendor information

optional

9

buyFromVendorName2

string

max 50

Vendor information

optional

10

buyFromAddress

string

max 100

Vendor information

optional

11

buyFromAddress2

string

max 50

Vendor information

optional

12

buyFromPostCode

string

max 20

Vendor information

optional

13

buyFromCity

string

max 30

Vendor information

optional

14

buyFromCounty

string

max 30

Vendor information

optional

15

buyFromCountry

string

max 10

Vendor information

optional

16

languageCode

string

max 10

Language Code

optional

17

locationCode

string

max 10

After posting, the items will be on this Location

mandatory

18

stockCenterCode

string

max 20

After posting, the items will be on this Stock Center

mandatory

19

externalProducer

string

max 20

External Stock Center

optional

20

vesselCode

string

max 20

The number of a vessel (boat or ship)

optional

21

vesselName

string

max 50

The name of the vessel

non-editable

22

landingDate

string

date

Landing date

optional

23

fishingArea

string

max 10

Fishing area code

optional

24

placeofLoading

string

max 10

Fields regarding shipping

optional

25

placeofDischarge

string

max 10

Fields regarding shipping

optional

26

placeofDelivery

string

max 10

Fields regarding shipping

optional

27

transporter

string

max 10

Fields regarding shipping

optional

28

transportMethodCode

string

max 10

Fields regarding shipping

Only on purchaseAgreements.

optional

29

shipmentMethodCode

string

max 10

Shipment Method Code. Only on openPurchaseAgreements and closedPurchaseAgreements.

optional

30

shippingReferenceNo

string

max 20

Shipping Reference No. Only on openPurchaseAgreements and closedPurchaseAgreements.

optional

31

expectedReceiptDate

string

date

Fields regarding shipping

optional

32

amount

number

decimal

The total amount of this purchase

non-editable

33

currencyCode

string

max 10

Currency Code

optional

34

postingDate

string

date

This date will be used for the ledger entries created when this is posted.

optional

35

vendorInvoiceNo

string

max 35

In order to post the purchase order, this must be given, but can be given on later stage.

mandatory

36

getBCTIInvoice

boolean


BCTI Invoice

optional

37

noOfLines

number

integer

Number of lines on this agreement

non-editable

38

noOfTradeItems

number

decimal

Total number of trade items on this agreement

non-editable

39

noOfTradeItemsAllocated

number

decimal

Allocated No. of TIs (Base)

non-editable

40

noOfTradeItemsReceived

number

decimal

Received Trade Items (Base)

non-editable

41

purchaseAgreementLines

array

json

Array of object purchaseAgreementLine. Can be added as a child array with ?$expand=purchaseAgreementLines. See API - Purchase Agreement Lines


42

systemRowVersion

number

integer

System row version. Increments every time the record is modified.

non-editable

43

lastModified

string

date-time

Automatic time stamp of last modification.

non-editable

44

modifiedByUser

string


The user who last modified the record

non-editable

Object Example

The response with only the properties from the “Purchase Agreement Header” (not the lines) looks like this:

JSON
{
    "systemId": "b443a749-239a-f011-b41a-000d3adf9fc2",
    "documentType": "Receipt",
    "documentNo": "RA2000004",
    "status": "Released",
    "orderDate": "2025-09-25",
    "vendorOrderNo": "",
    "buyFromVendorNo": "4203690429",
    "buyFromVendorName": "Þorbjörn hf.",
    "buyFromVendorName2": "",
    "buyFromAddress": "",
    "buyFromAddress2": "",
    "buyFromPostCode": "240",
    "buyFromCity": "GRINDAVÍK",
    "buyFromCounty": "",
    "buyFromCountry": "IS",
    "languageCode": "ISL",
    "locationCode": "",
    "stockCenterCode": "",
    "externalProducer": "",
    "vesselCode": "1234",
    "vesselName": "Sæfari GK 123",
    "landingDate": "2025-09-25",
    "fishingArea": "HALI",
    "placeofLoading": "",
    "placeofDischarge": "",
    "placeofDelivery": "",
    "transporter": "",
    "transportMethodCode": "",
    "expectedReceiptDate": "2025-09-25",
    "amount": 10000,
    "currencyCode": "",
    "postingDate": "2025-09-25",
    "vendorInvoiceNo": "",
    "getBCTIInvoice": false,
    "noOfLines": 1,
    "noOfTradeItems": 100,
    "noOfTradeItemsAllocated": 0,
    "noOfTradeItemsReceived": 0,
    "systemRowVersion": 2614087,
    "lastModified": "2025-09-30T17:14:22.093Z",
    "modifiedByUser": ""
}

On openPurchaseAgreements and closedPurchaseAgreements the object has the same properties, except that transportMethodCode is replaced by shipmentMethodCode and shippingReferenceNo, and the order of some properties differs (see Overview).


Procedures

  • 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])/openPurchaseAgreements([record-id])/Microsoft.NAV.[procedureName]

  • Only the open purchased agreements can be modified, so if trying to run some procedures on closed agreements that are only allowed for open ones, an error should be returned that explains why.

  • Procedures are available on purchaseAgreements and openPurchaseAgreements. The endpoint closedPurchaseAgreements has no procedures.

In general, if the request is successful, the response is 200 OK and could also possibly contain a message in the value property. For example:

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"
}

Procedure

Parameters

Description

Details

release

none

Release the agreement (Status becomes Released). Available on purchaseAgreements and openPurchaseAgreements.

Show more

reOpen

none

Reopen a released agreement (Status becomes Open). Available on purchaseAgreements and openPurchaseAgreements.

Show more

createPostingDocument

none

Create the posting document (Purchase Order or Purchase Invoice) for a released agreement. Available on purchaseAgreements and openPurchaseAgreements.

Show more

receiveItems

none

Create the Purchase Order if it does not exist, and post it as received (items into inventory, not invoiced). Available on purchaseAgreements and openPurchaseAgreements.

Show more

AddNote

noteText (text, max 250)

Add a note to the agreement. The note is registered as from the API user. Available on purchaseAgreements only.

Show more

AddNoteFromUser

noteText (text, max 250), fromUser (code, max 50)

Add a note to the agreement, registered as from the given Business Central user. The user must exist in User Setup. Available on purchaseAgreements only.

Show more


Procedures on purchaseAgreements

Release

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

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

(no parameters)

After a successful request:

  • The Status becomes Released.

The value property of the response is Agreement <No.> has been released.

Possible errors:

  • The agreement does not exist on the endpoint (standard Business Central error, record not found).

  • <Table Caption> <No.> is already released! (when the Status is already Released). The table caption is “Purchase Agreement Header” in English, e.g. Purchase Agreement Header RA2000004 is already released!

  • Errors from the Wisefish release of the agreement, the same checks as when the agreement is released in Business Central.

Behaviour notes:

  • The API only checks for the status Released; for any other status the agreement is passed on to the Wisefish release function.


Reopen

The procedure name is reOpen (with a capital O).

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

JSON
POST
[server]/api/wisefish/base/v1.0/companies([CompanyGUID])/purchaseAgreements([record-id])/Microsoft.NAV.reOpen

(no parameters)

After a successful request:

  • The Status becomes Open.

The value property of the response is <Table Caption> <No.> has been re-opened, e.g. Purchase Agreement Header RA2000004 has been re-opened.

Possible errors:

  • The agreement does not exist on the endpoint (standard Business Central error, record not found).

  • <Table Caption> <No.> is already open! (when the Status is already Open), e.g. Purchase Agreement Header RA2000004 is already open!

  • Errors from the Wisefish reopen of the agreement, the same checks as when the agreement is reopened in Business Central.


Create Posting Document

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

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

(no parameters)

After a successful request:

  • A purchase document (Purchase Order or Purchase Invoice, depends on settings) has been created for the agreement.

The value property of the response is Purchase document <Document Type> <No.> created for agreement <Agreement No.>., e.g. Purchase document Order PO2000123 created for agreement RA2000004.

Possible errors:

  • The agreement does not exist on the endpoint (standard Business Central error, record not found).

  • The Status is not Released (standard Business Central TestField error, e.g. “Status must be equal to 'Released' in Purchase Agreement Header: Document Type=Receipt, No.=RA2000004. Current value is 'Open'.”).

  • Purchase Document Type should be Order or Invoice (when the Posting Document Type of the agreement is Fishing Trip or Repacking).

  • Errors from the Wisefish creation of the purchase document.

Behaviour notes:

  • The type of the created document follows the Posting Document Type of the agreement: Order creates a Purchase Order, Invoice creates a Purchase Invoice.

  • If any line on the agreement has a negative quantity, the document is created with the Wisefish option “and Credit” (Order and Credit / Invoice and Credit).


Receive Items

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

JSON
POST
[server]/api/wisefish/base/v1.0/companies([CompanyGUID])/purchaseAgreements([record-id])/Microsoft.NAV.receiveItems

(no parameters)

This method does both:

  • Creates a Purchase Order for the agreement, if no posting document exists yet. If a posting document exists, the existing Purchase Order of the agreement is used.

  • The purchase order is posted with the “receipt” option, which means that items are in stock, and the order waits for the invoice to be created later.

The value property of the response is Receipt of agreement <Agreement No.>: Receipt <Receipt No.> for Purchase Order <Order No.> posted successfully.

Possible errors:

  • The agreement does not exist on the endpoint (standard Business Central error, record not found).

  • Purchase Order for agreement <Agreement No.> is missing! (when the agreement already has a posting document, but no Purchase Order, e.g. a Purchase Invoice).

  • Purchase Document Type should be Order or Invoice (when no posting document exists and the Posting Document Type is Fishing Trip or Repacking).

  • Errors from the Wisefish creation of the purchase document.

  • Posting receipt only supports Purchase Orders! (when the created posting document is a Purchase Invoice, i.e. the Posting Document Type is Invoice).

  • Standard Business Central posting errors from the receipt posting (Purch.-Post).

Behaviour notes:

  • Unlike createPostingDocument, the API code does not check that the agreement is Released before the document is created.

  • The order is posted with Receive = true and Invoice = false; the quantities to receive are not synchronised with item tracking first.


Add Note

The procedure AddNote adds a note to the purchase 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).

JSON
POST
.../purchaseAgreements([record-id])/Microsoft.NAV.AddNote

Body:
{
    "noteText": [the text of the note]
}

Parameters

Type

Max Len

Description


noteText

string

250

The text of the note.

mandatory

A note is added to the purchase agreement, and the value property of the response is Note successfully added.

Possible errors:

  • The purchase agreement does not exist (standard Business Central error, record not found).

  • noteText is longer than 250 characters (standard Business Central error, the text exceeds the parameter length).

Behaviour notes:

  • The note text is not validated: an empty noteText is 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.

JSON
POST
.../purchaseAgreements([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


noteText

string

250

The text of the note.

mandatory

fromUser

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 purchase agreement, and the value property of the response is Note successfully added and registered from user <fromUser>.

Possible errors:

  • The purchase 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 (when fromUser is not found in User Setup)

Behaviour notes:

  • fromUser is a code parameter, so the value is converted to upper case: "john" is registered and returned as JOHN.

  • If fromUser is empty, no user check is made and the note is registered as from the API user (same as AddNote), 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 noteText is not rejected.


Procedures on openPurchaseAgreements

The endpoint openPurchaseAgreements has the procedures release, reOpen, createPostingDocument and receiveItems. They run exactly the same code as on purchaseAgreements, see Release, Reopen, Create Posting Document and Receive Items above. Only the endpoint in the URL differs:

JSON
POST
[server]/api/wisefish/base/v1.0/companies([CompanyGUID])/openPurchaseAgreements([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 Received or Fully Received; other agreements are not found. AddNote and AddNoteFromUser are not available on this endpoint.


Procedures on closedPurchaseAgreements

The endpoint closedPurchaseAgreements is read-only and has no procedures.


Examples

Read purchase agreements

Read all open agreements

Reads the agreements that are still open for changes (Status Open, Released, Partly Received or Fully Received), with only a few properties.

Request:

JSON
GET .../openPurchaseAgreements?$select=documentNo,status,buyFromVendorNo,buyFromVendorName,expectedReceiptDate

Response:

JSON
{
    "@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#openPurchaseAgreements(documentNo,status,buyFromVendorNo,buyFromVendorName,expectedReceiptDate)",
    "value": [
        {
            "@odata.etag": "W/\"JzIwOzExMTg5ODcyMDAwMzUyNTUzMzI0MTswMDsn\"",
            "documentNo": "RA2000004",
            "status": "Released",
            "buyFromVendorNo": "4203690429",
            "buyFromVendorName": "Þorbjörn hf.",
            "expectedReceiptDate": "2025-09-25"
        },
        {
            "@odata.etag": "W/\"JzIwOzE0NTU2NzI4MzEwNjc0MjM5ODIxOzAwOyc=\"",
            "documentNo": "RA2000003",
            "status": "Open",
            "buyFromVendorNo": "5501692829",
            "buyFromVendorName": "Fiskmarkaður Suðurnesja hf.",
            "expectedReceiptDate": "2025-09-26"
        }
    ]
}

Read released agreements of a vendor

Reads the released agreements of vendor 4203690429 from purchaseAgreements.

JSON
GET .../purchaseAgreements?$filter=buyFromVendorNo eq '4203690429' and status eq 'Released'

Read closed agreements posted in a period

Reads the closed agreements with a posting date in September 2025.

JSON
GET .../closedPurchaseAgreements?$filter=postingDate ge 2025-09-01 and postingDate le 2025-09-30

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=purchaseAgreementLines

GET ... purchaseAgreements([system-id])?$expand=purchaseAgreementLines
Expand to see the example json

An example of a response:

JSON
GET ... purchaseAgreements(b443a749-239a-f011-b41a-000d3adf9fc2)?$expand=purchaseAgreementLines

{
    "@odata.context": "https://api.businesscentral.dynamics.com/v2.0/b33a6a3b-244c-4295-84b3-0ad90823c736/AB_Test_191125/api/wisefish/base/v1.0/$metadata#companies(1691e98a-6a95-f011-b41a-6045bde126e9)/purchaseAgreements/$entity",
    "@odata.etag": "W/\"JzIwOzExMTg5ODcyMDAwMzUyNTUzMzI0MTswMDsn\"",
    "systemId": "b443a749-239a-f011-b41a-000d3adf9fc2",
    "documentType": "Receipt",
    "documentNo": "RA2000004",
    "status": "Released",
    "orderDate": "2025-09-25",
    "vendorOrderNo": "",
    "buyFromVendorNo": "4203690429",
    "buyFromVendorName": "Þorbjörn hf.",
    "buyFromVendorName2": "",
    "buyFromAddress": "",
    "buyFromAddress2": "",
    "buyFromPostCode": "240",
    "buyFromCity": "GRINDAVÍK",
    "buyFromCounty": "",
    "buyFromCountry": "IS",
    "languageCode": "ISL",
    "locationCode": "",
    "stockCenterCode": "",
    "externalProducer": "",
    "vesselCode": "1234",
    "vesselName": "Sæfari GK 123",
    "landingDate": "2025-09-25",
    "fishingArea": "HALI",
    "placeofLoading": "",
    "placeofDischarge": "",
    "placeofDelivery": "",
    "transporter": "",
    "transportMethodCode": "",
    "expectedReceiptDate": "2025-09-25",
    "amount": 10000,
    "currencyCode": "",
    "postingDate": "2025-09-25",
    "vendorInvoiceNo": "",
    "getBCTIInvoice": false,
    "noOfLines": 1,
    "noOfTradeItems": 100,
    "noOfTradeItemsAllocated": 0,
    "noOfTradeItemsReceived": 0,
    "purchaseAgreementLines": [
        {
            "@odata.etag": "W/\"JzIwOzE3MjI2NDI3NTI4MzQ1MzA1NzY2MTswMDsn\"",
            "systemId": "2559e15b-239a-f011-b41a-000d3adf9fc2",
            "documentType": "Receipt",
            "documentNo": "RA2000004",
            "lineNo": 10000,
            "type": "Item",
            "itemNo": "ZZZ1003",
            "description": "Lifur - lánað til Lýsi",
            "noOfTradeItems": 100,
            "tradeItemUnitOfMeasure": "KG",
            "quantity": 100,
            "unitOfMeasure": "KG",
            "quantityBase": 100,
            "baseUnitOfMeasure": "KG",
            "directUnitCost": 100,
            "unitCost": 100,
            "lineAmount": 10000,
            "lineDiscount": 0,
            "lineDiscountAmount": 0,
            "amount": 10000,
            "vat": 11,
            "amountIncludingVAT": 11100,
            "productionDate": "2025-09-25",
            "originalProducer": "",
            "lot": "",
            "netWeight": 100,
            "grossWeight": 0,
            "landingDate": "2025-09-25",
            "portOfLanding": "",
            "addComment": "",
            "systemRowVersion": 2614102,
            "lastModified": "2025-10-02T13:18:31.53Z",
            "modifiedByUser": ""
        }
    ],
    "systemRowVersion": 2614087,
    "lastModified": "2025-09-30T17:14:22.093Z",
    "modifiedByUser": ""
}


Create, change and delete purchase agreements

Create an agreement with lines

JSON
POST .../purchaseAgreements?$expand=purchaseAgreementLines

Body:

{
    "orderDate": "2025-12-02",
    "buyFromVendorNo": "4203690429",
    "locationCode": "001",
    "vendorInvoiceNo": "AFH-001",
    "purchaseAgreementLines": [
        {
            "itemNo": "ZZZ1003",
            "noOfTradeItems": 300,
            "tradeItemUnitOfMeasure": "KG",
            "productionDate": "2025-12-02"
        }
    ]
}

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

Change an agreement

Sets the vendor invoice no. and the posting date on agreement RA2000004 with PATCH; the If-Match header holds the @odata.etag of the record (the response is shortened).

Request:

JSON
PATCH .../openPurchaseAgreements(b443a749-239a-f011-b41a-000d3adf9fc2)
If-Match: W/"JzIwOzExMTg5ODcyMDAwMzUyNTUzMzI0MTswMDsn"

{
    "vendorInvoiceNo": "AFH-001",
    "postingDate": "2025-09-30"
}

Response:

JSON
{
    "@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#openPurchaseAgreements/$entity",
    "@odata.etag": "W/\"JzIwOzE2MDQ1NTg4MTkyMDMzNzYxOTA4MTswMDsn\"",
    "systemId": "b443a749-239a-f011-b41a-000d3adf9fc2",
    "documentType": "Receipt",
    "documentNo": "RA2000004",
    ...
    "postingDate": "2025-09-30",
    "vendorInvoiceNo": "AFH-001",
    ...
}

Delete an agreement

Deletes an open agreement; the response is 204 No Content.

JSON
DELETE .../openPurchaseAgreements(b443a749-239a-f011-b41a-000d3adf9fc2)
If-Match: *


Status Changes

Release an agreement

Releases agreement RA2000004 with release.

Request:

JSON
POST .../purchaseAgreements(b443a749-239a-f011-b41a-000d3adf9fc2)/Microsoft.NAV.release

(no parameters)

Response:

JSON
{
    "@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#Edm.String",
    "value": "Agreement RA2000004 has been released"
}

Release an agreement that is already released

Calling release again on the same agreement fails.

Request:

JSON
POST .../purchaseAgreements(b443a749-239a-f011-b41a-000d3adf9fc2)/Microsoft.NAV.release

(no parameters)

Response:

JSON
{
    "error": {
        "code": "Application_DialogException",
        "message": "Purchase Agreement Header RA2000004 is already released!"
    }
}

Reopen an agreement

Reopens the released agreement RA2000004 with reOpen.

Request:

JSON
POST .../purchaseAgreements(b443a749-239a-f011-b41a-000d3adf9fc2)/Microsoft.NAV.reOpen

(no parameters)

Response:

JSON
{
    "@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#Edm.String",
    "value": "Purchase Agreement Header RA2000004 has been re-opened"
}


Posting

Create the posting document for an agreement

Creates the Purchase Order for the released agreement RA2000004 with createPostingDocument.

Request:

JSON
POST .../purchaseAgreements(b443a749-239a-f011-b41a-000d3adf9fc2)/Microsoft.NAV.createPostingDocument

(no parameters)

Response:

JSON
{
    "@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#Edm.String",
    "value": "Purchase document Order PO2000123 created for agreement RA2000004."
}

Receive the items of an agreement

Posts the receipt of agreement RA2000004 with receiveItems on the openPurchaseAgreements endpoint; the existing Purchase Order PO2000123 is used.

Request:

JSON
POST .../openPurchaseAgreements(b443a749-239a-f011-b41a-000d3adf9fc2)/Microsoft.NAV.receiveItems

(no parameters)

Response:

JSON
{
    "@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#Edm.String",
    "value": "Receipt of agreement RA2000004: Receipt PR2000045 for Purchase Order PO2000123 posted successfully."
}


Add notes

Add a note to a purchase agreement

Adds the note “Quality check completed” to agreement RA2000004 with AddNote; the note is registered as from the API user.

Request:

JSON
POST .../purchaseAgreements(b443a749-239a-f011-b41a-000d3adf9fc2)/Microsoft.NAV.AddNote
{
    "noteText": "Quality check completed"
}

Response:

JSON
{
    "@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#Edm.String",
    "value": "Note successfully added"
}

Add a note to a purchase agreement from a specific user

Adds the same note to agreement RA2000004 with AddNoteFromUser, registered as from user JOHN.

Request:

JSON
POST .../purchaseAgreements(b443a749-239a-f011-b41a-000d3adf9fc2)/Microsoft.NAV.AddNoteFromUser
{
    "noteText": "Quality check completed",
    "fromUser": "JOHN"
}

Response:

JSON
{
    "@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#Edm.String",
    "value": "Note successfully added and registered from user JOHN"
}

Add a note from a user that does not exist

Calls AddNoteFromUser with a user ID that is not in User Setup; the call fails and no note is added (the error message is shortened).

Request:

JSON
POST .../purchaseAgreements(b443a749-239a-f011-b41a-000d3adf9fc2)/Microsoft.NAV.AddNoteFromUser
{
    "noteText": "Quality check completed",
    "fromUser": "NOBODY"
}

Response:

JSON
{
    "error": {
        "code": "Application_DialogException",
        "message": "User with ID NOBODY does not exist"
    }
}