Transactions API returns "Company not found" EntityNotFoundError

  • 2
  • Problem
  • Updated 2 months ago
I'm using Avatax Trial to fetch transactions created. In Swagger I enter my trial login/password https://rest.avatax.com/swagger/ui/index.html
There I choose "list all transactions" and enter my company id (6 digits).
Here's the error I get:

{"error"=>{"code"=>"EntityNotFoundError", "message"=>"Company not found.", "target"=>"HttpRequest", "details"=>[{"code"=>"EntityNotFoundError", "number"=>4, "message"=>"Company not found.", "description"=>"The Company with code '123456' was not found.", "faultCode"=>"Client", "helpLink"=>"http://developer.avalara.com/avatax/errors/EntityNotFoundError";, "severity"=>"Error"}]}}

Photo of vanya

vanya

  • 2 Posts
  • 0 Reply Likes

Posted 4 months ago

  • 2
Photo of vanya

vanya

  • 2 Posts
  • 0 Reply Likes
It looks like the usage of company code and company id is inconsistent in API. In one place (e.g. customers) I should use company id (numbers), while in another place (transactions) I should use company code (string)
Photo of Wayne Myer

Wayne Myer, Official Rep

  • 210 Posts
  • 25 Reply Likes
Hi Vanya,

That is exactly what is happening. Some endpoints require companyCode and others require the integer company ID. The ListTransactionsByCompany endpoint requires companyCode. 

Let us know if you have any additional questions.

Thank you,
Wayne Myer
Photo of Craig Constantine

Craig Constantine

  • 6 Posts
  • 0 Reply Likes
Are there any other possible causes for this problem? I'm getting this error too.

I'm certain I have the right company ID value; I even triple-checked that I see it in the sandbox console URL when I view transactions.
Photo of Katina

Katina, Official Rep

  • 251 Posts
  • 25 Reply Likes
Craig,

Which endpoint are you using? I've you're passing companyId to an endpoint expecting CompanyCode, that would explain this behavior.
Photo of Craig Constantine

Craig Constantine

  • 6 Posts
  • 0 Reply Likes
oh! What's the difference between CompanyCode and CompanyID?

I'm using Avalara's PHP library and the implementation of ListTransactionsByCompany takes the company code argument and inserts it into a string which is used as the path for the REST call. So it won't matter if I pass a string or an integer; It'll just end up in the REST call's path...
Photo of Katina

Katina, Official Rep

  • 251 Posts
  • 25 Reply Likes
CompanyCode = user-defined code, string, typically an acronym or shortened version of company name or a division id (for example, Avalara might use "AVA"). Unique in account.
CompanyId = system defined, integer, unique across environment

If you log into the AvaTax UI, the CompanyCode shows in the company details if you go to Manage Companies.
Photo of Craig Constantine

Craig Constantine

  • 6 Posts
  • 0 Reply Likes
update Sept 3: I've figured this out. Found help in another topic, https://community.avalara.com/avalara/topics/listtransactionsbycompany-not-returning-any-data

Thanks! I've gotten that parameter's value correct. But I'm still not getting transactions returned which I expect...

In the sandbox I see these transactions:

I'm specifying a filter with dates—these three are more than 30 days in the past, and wouldn't be returned by default (I tried it too.)

taxDate ge 2019-07-15 AND taxDate le 2019-08-05 AND status ne 'committed' AND type eq 'SalesInvoice'

But my ListTransactionsByCompany returns @recordsetCount of zero.
(Edited)
Photo of Katina

Katina, Official Rep

  • 251 Posts
  • 25 Reply Likes
Craig,

I'm glad you got that figured out! Sometimes the date filtering can be a little tricky. Please reach out if you encounter further issues/questions.