0

I am using the Xero.NetStandard.OAuth2 nuget package to integrate my project with Xero's API.

I have a use case where I need to query a bunch of Items using the GetItemsAsyncWithHttpInfo method. This accepts a filter parameter called "where", in which I am attempting to pass through a list of Guid IDs corresponding to the ItemID.

My issue straight off the bat is that it has trouble accepting Guid values when querying the API through this package. An example would be as follows:

var apiResponse = await api.GetItemsAsyncWithHttpInfo(accessToken, xeroTenantID, where: $"ItemID==\"275795E7-4323-4852-B21E-254DB9D6F5EF\"");

The response I get is Operator '==' incompatible with operand types 'Guid' and 'String'.

Any ideas on how to get this working?

Package version 0.4.5 (latest stable) is being used.

theklaw
  • 1
  • 2
  • Is there any need to use the "where" clause when you already have the Item ID? Isn't it easier to just request the item directly? (I don't use the .net API, while my code is VB I just use HTTP GETs directly on the various endpoints, so I'm not au fait with the API). – droopsnoot Feb 10 '22 at 18:06

1 Answers1

0

You can wrap the id in in GUID(). In my code, when querying for repeating invoices belonging to a certain contact, I have a where string like so:

 'Contact.ContactID==GUID("' + contact_id + '")&&Type="ACCREC"'

sscarduzio
  • 5,938
  • 5
  • 42
  • 54