Get sales invoice - line custom field data with API

Is it possible to retrieve the data from a Sales Invoice - Line custom field using the API?

I have contracted a local developer to assist in developing an integration for our fiscal data requirements as per this topic. We are now required to include harmonized system (HS) codes for all line items on our invoices. I have created a custom field for this purpose:


This is populating the field in the sales invoice as expected:

However, the developer tells me that it is not accessible through the API. I have tried accessing the API using https://editor-next.swagger.io/ and the request URL https://[domain].manager.io/api2/sales-invoice-lines?term=10135&sortByDesc=true&sortBy=Reference and get the following:

{
  "business": {
    "name": "[business name]"
  },
  "skip": 0,
  "pageSize": 50,
  "totalRecords": 4,
  "salesInvoiceLines": [
    {
      "edit": null,
      "view": null,
      "issueDate": "2024-12-10",
      "reference": "10135",
      "customer": "[customer name]",
      "description": "[description]",
      "item": "cytu028 - [item name]",
      "account": "VAT payable",
      "qty": null,
      "unitPrice": {
        "value": 1210,
        "currency": "USD"
      },
      "discount": null,
      "amount": {
        "value": 157.83,
        "currency": "USD"
      }
    },
    {
      "edit": null,
      "view": null,
      "issueDate": "2024-12-10",
      "reference": "10135",
      "customer": "[customer name]",
      "description": "[description]",
      "item": "cytu028 - [item name]",
      "account": "Inventory - sales",
      "qty": 1,
      "unitPrice": {
        "value": 1210,
        "currency": "USD"
      },
      "discount": null,
      "amount": {
        "value": 1052.17,
        "currency": "USD"
      }
    },
    {
      "edit": null,
      "view": null,
      "issueDate": "2024-12-10",
      "reference": "10135",
      "customer": "[customer name]",
      "description": "[description]",
      "item": "tlry021 - [item name]",
      "account": "VAT payable",
      "qty": null,
      "unitPrice": {
        "value": 30,
        "currency": "USD"
      },
      "discount": null,
      "amount": {
        "value": 3.91,
        "currency": "USD"
      }
    },
    {
      "edit": null,
      "view": null,
      "issueDate": "2024-12-10",
      "reference": "10135",
      "customer": "[customer name]",
      "description": "[description]",
      "item": "tlry021 - [item name]",
      "account": "Inventory - sales",
      "qty": 1,
      "unitPrice": {
        "value": 30,
        "currency": "USD"
      },
      "discount": null,
      "amount": {
        "value": 26.09,
        "currency": "USD"
      }
    }
  ]
}

I don’t see the HS code. Is there something else we should be doing to get it?

1 Like

You need to get all the references like Customer, Inventory, TaxCode, and Custom Fields before you get the Sales data.

Then combine all the references needed into the Sales record to get complete Sales Invoice data.

It will be even more complicated if you make Credit/Debit Notes. You must call the Invoice Reference that is credited/debited along with all the references needed.

Unless you use a separate database on your application, and synchronize the application data with the manager data through the API.

If you use Relay, you can get complete sales, credit/debit Notes data without having to retrieve repetitive data to the Manager.

4 Likes

Is there a way to get the accountsReceivable object on the customer via the Relay. It contains the transaction’s currency (not base currency). It is the only piece of information mising to make sure everything is recorded in the correct currency when using the relay

Welcome to the forum @tawedzerwa_chagwesha,

There’s no accountsReceivable object. It’s just a record (or a tuple if you like) displayed on tabular data to group monetary figures and their currencies.

To get the currency within a transaction you must look it up inside the master record it refers to, and this depends on the transaction type:

  • Use customer object for Sales transactions

  • Use supplier object for Purchase transactions

  • Use employee object for Payslips

  • Use bankOrCashAccount for Receipts and Payments

1 Like

@tawedzerwa_chagwesha

Try creating a customer in a foreign currency, then make an invoice for that customer and set the relay to https://relay.manager.io. Save your changes and click the Relay button.

Once you’ve done that, you’ll see all the data sent through the relay on the page.

1 Like