Search code examples
intuit-partner-platformquickbooks-online

QBO Payment Query returns 'unauthorized'


When I perform a search by LastUpdatedTime I get "401 Unauthorized Error". Query by CustomerId works fine

Here is my code:

var pq = new PaymentQuery()
{
    LastUpdatedTime = new DateTime(2012,12,21),
};

pq.SpecifyOperatorOption(Intuit.Ipp.Data.Qbo.FilterProperty.LastUpdatedTime, FilterOperatorType.AFTER);
var list = pq.ExecuteQuery<Payment>(commonService.ServiceContext);

Application throws Intuit.Ipp.Exception.InvalidTokenException in ExecuteQuery


Solution

  • The SDK does not encode the datetime correctly, so you will need to use DevDefined and deserialize the response with the SDK. Code sample: https://gist.github.com/IntuitDeveloperRelations/6024616