0

I need to show a weekly summary of bills we owe to our suppliers Below is a sample api call for a particular supplier given by the contact ID. The filters we applied include the date and the invoice type

ContactIDs : 56f1293d-c234-4579-b144-061c1ce591b9

where : Date >= DateTime(2019, 03, 01) && Date < DateTime(2019, 03, 12)&&Type==ACCPAY

Statuses : AUTHORISED

The raw HTTP GET request

https://api.xero.com/api.xro/2.0/Invoices?ContactIDs=56f1293d-c234-4579-b144-061c1ce591b9&where=Date%20%3E%3D%20DateTime(2019,%2003,%2001)%20%26%26%20Date%20%3C%20DateTime(2019,%2003,%2012)%26%26Type%3D%3DACCPAY&Statuses=AUTHORISED

But the response I get is

{
  "ErrorNumber": 16,
  "Type": "QueryParseException",
  "Message": "No property or field 'ACCPAY' exists in type 'Invoice'"
}

Any idea why this is happening?. There is no issues with credentials or anything and other API calls work just fine.

Vinay
  • 7,442
  • 6
  • 25
  • 48

1 Answers1

2

Actually I'll post my comment as the answer.

Xero API uses c# syntax in it's where clauses so you need to surround ACCPAY with double quotes. So the correct syntax for your where clause is:

Date >= DateTime(2019, 03, 01) && Date < DateTime(2019, 03, 12)&&Type=="ACCPAY"
sheavens
  • 685
  • 7
  • 14