'Xero.NetStandard.OAuth2 Using the "where" parameter to query Items by a list of ItemID
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.
Solution 1:[1]
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"'
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | sscarduzio |