Entity is not api accessible
The error can be due to :
The object name is not stated correctly ,it happens when we use custom object we forgot to include __c :
Example : Use incorrectly MyObject instead of MyObject__c
Or some typo,I am not sure why it didnot give proper error but some of the typo below my cause some issue .Note service is not declared in the code below.