purchaseInvoice resource type

Represents a purchase invoice in Business Central.

Note

For information about enabling APIs for Business Central see Enabling the APIs for Dynamics 365 Business Central.

Methods

Method Return Type Description
GET purchaseInvoice purchaseInvoice Gets a purchase invoice object.
DELETE purchaseInvoice none Deletes a purchase invoice object.
POST purchaseInvoice purchaseInvoice Creates a purchase invoice object.
PATCH purchaseInvoice purchaseInvoice Updates a purchase invoice object.

Bound Actions

The purchaseInvoice resource type offers a bound action called post which posts the corresponding purchaseInvoice batch. This is illustrated in the following example: POST https://<server address>:<server API port>/<server instance name>/api/v2.0/companies({id})/purchaseInvoices({id})/Microsoft.NAV.post

The response has no content; the response code is 204.

Navigation Return Type Description
vendor vendor Gets the vendor of the purchaseInvoice.
dimensionValue dimensionValue Gets the dimensionvalue of the purchaseInvoice.
currency currency Gets the currency of the purchaseInvoice.
dimensionSetLines dimensionSetLines Gets the dimensionsetlines of the purchaseInvoice.
purchaseInvoiceLines purchaseInvoiceLines Gets the purchaseinvoicelines of the purchaseInvoice.
pdfDocument pdfDocument Gets the pdfdocument of the purchaseInvoice.
attachments attachments Gets the attachments of the purchaseInvoice.
documentAttachments documentAttachments Gets the documentattachments of the purchaseInvoice.

Properties

Property Type Description
id GUID The unique ID of the purchase invoice. Non-editable.
number string Specifies the number of the purchase invoice.
postingDate date The date that the purchase invoice is posted.
invoiceDate date The invoice date .
dueDate date T he date the purchase invoice is due.
vendorInvoiceNumber string The vendor sales order reference for the purchase invoice.
vendorId GUID The unique ID of vendor.
vendorNumber string Specifies vendor's number.
vendorName string Specifies vendor's name.
payToName string Pay to name of the purchase invoice.
payToContact string Pay to contact.
payToVendorId GUID Pay to vendor id.
payToVendorNumber string Pay to vendor number.
shipToName string Ship to name.
shipToContact string Ship to contact.
buyFromAddressLine1 string Buy from address line 1.
buyFromAddressLine2 string Buy from address line 2.
buyFromCity string Buy from city.
buyFromCountry string Buy from state.
buyFromState string Buy from state.
buyFromPostCode string Buy from country.
shipToAddressLine1 string Ship to address line 1.
shipToAddressLine2 string Ship to address line 2.
shipToCity string Ship to city.
shipToCountry string Ship to country.
shipToState string Ship to state.
shipToPostCode string Ship to post code.
payToAddressLine1 string Pay to address line 1.
payToAddressLine2 string Pay to address line 2.
payToCity string Pay to address line 2.
payToCountry string Pay to country.
payToState string Pay to state.
payToPostCode string Pay to post code.
shortcutDimension1Code string
shortcutDimension2Code string
currencyId GUID Specifies which currency the purchase invoice uses.
currencyCode string The default currency code for the purchase invoice.
orderId GUID The id of the order to which the purchase invoice is associated to. Read-Only.
orderNumber string The number of the order to which the purchase invoice is associated to. Read-Only.
purchaser string The purchaser in the purchase invoice.
pricesIncludeTax boolean Specifies whether the prices include Tax or not. Read-Only.
discountAmount decimal The purchase invoice discount amount.
discountAppliedBeforeTax boolean Specifies whether the discount is applied before tax.
totalAmountExcludingTax decimal The total amount excluding tax. Read-Only.
totalTaxAmount decimal The total tax amount for the purchase invoice. Read-Only.
totalAmountIncludingTax decimal The total amount including tax. Read-Only.
status NAV.invoiceEntityAggregateStatus The status of the purchase invoice. It can be " ", "Draft", "In Review", "Open", "Paid", "Canceled" or "Corrective".
lastModifiedDateTime datetime The last datetime the purchase invoice was modified. Read-Only.

JSON representation

Here is a JSON representation of the purchaseInvoice resource.

{
    "id": "GUID",
    "number": "string",
    "postingDate": "date",
    "invoiceDate": "date",
    "dueDate": "date",
    "vendorInvoiceNumber": "string",
    "vendorId": "GUID",
    "vendorNumber": "string",
    "vendorName": "string",
    "payToName": "string",
    "payToContact": "string",
    "payToVendorId": "GUID",
    "payToVendorNumber": "string",
    "shipToName": "string",
    "shipToContact": "string",
    "buyFromAddressLine1": "string",
    "buyFromAddressLine2": "string",
    "buyFromCity": "string",
    "buyFromCountry": "string",
    "buyFromState": "string",
    "buyFromPostCode": "string",
    "shipToAddressLine1": "string",
    "shipToAddressLine2": "string",
    "shipToCity": "string",
    "shipToCountry": "string",
    "shipToState": "string",
    "shipToPostCode": "string",
    "payToAddressLine1": "string",
    "payToAddressLine2": "string",
    "payToCity": "string",
    "payToCountry": "string",
    "payToState": "string",
    "payToPostCode": "string",
    "shortcutDimension1Code": "string",
    "shortcutDimension2Code": "string",
    "currencyId": "GUID",
    "currencyCode": "string",
    "orderId": "GUID",
    "orderNumber": "string",
    "purchaser": "string",
    "pricesIncludeTax": "boolean",
    "discountAmount": "decimal",
    "discountAppliedBeforeTax": "boolean",
    "totalAmountExcludingTax": "decimal",
    "totalTaxAmount": "decimal",
    "totalAmountIncludingTax": "decimal",
    "status": "NAV.invoiceEntityAggregateStatus",
    "lastModifiedDateTime": "datetime"
}

Note

The id property value in this API resource might be different than the systemId of the corresponding record because the systemId of the unposted invoices are carried to posted invoices in the API, but not to the record. Use the https://{businesscentralPrefix}/microsoft/automate/v1.0/companies({id})/postedPurchaseInvoices({systemId}) route and extract the apiId property to map the systemId of a posted purchase invoice record to the purchaseInvoice API resource.

GET purchaseInvoice
DELETE purchaseInvoice
POST purchaseInvoice
PATCH purchaseInvoice