Question

I have built a QuickBooks Online integration using QuickBooks Anywhere. I am using the paid edition of QuickBooks Online, but my customer is using the trial. My app is currently in development mode and has not been approved by the Intuit Marketplace.

This code works fine with my site. Does being on a trial of QuickBooks Online mean you can't write data? My customer was able to pull a list of accounts, vendors, and payment methods just fine.

Here is my code:

ItemQuery itQuery = new ItemQuery();
itQuery.Name = "Unknown";
itemsList = itQuery.ExecuteQuery<Item>();

QBO : Error 1/23/2013 12:59:48 PM Error querying items : Intuit.Ipp.Exception.InvalidTokenException: Unauthorized at Intuit.Ipp.Services.QboService.Get[T](IQboQuery qboQuery, String simpleQuery, Boolean isQuerySpecified) at Intuit.Ipp.Services.ServiceExtensions.ExecuteQuery[T](IQuery query, ServiceContext serviceContext)

The customer can authenticate OK:

OAuthRequestValidator oauthValidator = new OAuthRequestValidator(acT, acTS, coK, coKS);
IntuitServicesType st = IntuitServicesType.QBO;
ServiceContext context = new ServiceContext(oauthValidator, acT, cId, st);
dataServices = new DataServices(context);
Was it helpful?

Solution

I found out that if the itQuery.Name variable is null or an empty string, then you will receive this error. Can Intuit change the error message to say, "You must specify a value for the Item Query Name field. You have entered an empty or null string."

In my particular case, I had a string that was supposed to say unknown. It was an empty string.

OTHER TIPS

You will need to add error checking to your application to ensure you are not passing empty string. Otherwise you are making an unnecessary API call.

The root cause seems to be that the signature is not calculated correctly by the DevKit when an empty string is passed, but the request is not valid.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top