1

I am able to get the Invoice details by using Total or AmountPaid as shown below:

var invoices = public_app_api.Invoices.Where("Total=100").Find();

var invoices = public_app_api.Invoices.Where("AmountPaid=100").Find();

I am unable to get the Invoice details by InvoiceID like..

var invoices = public_app_api.Invoices.Where("InvoiceID=c5b238f4-1356-4cad-89d0-681b6d182ea7").Find();

ERROR AS:- Xero.Api.Infrastructure.Exceptions.BadRequestException: 'No property or field 'c5b238f4' exists in type 'Invoice''

How can I fix this?

Kitson88
  • 2,889
  • 5
  • 22
  • 37
Muttu B C
  • 37
  • 5

1 Answers1

2

As per the docs, a filter should look something like:

Type=="BANK"

As such, your:

Where("InvoiceID="+ID)

line should instead be:

Where(@"InvoiceID==""" + ID + @"""")

The key difference is the use of == rather than = and the " surrounding the ID value.

If that doesn't work, try using the GUID format:

var invoices = public_app_api.Invoices.Find(
    new System.Guid("c5b238f4-1356-4cad-89d0-681b6d182ea7"));
mjwills
  • 23,389
  • 6
  • 40
  • 63