Time to read up a bit on PHP namespaces! Your function(Query) is interpreting Query as being in your current namespace (App\Controller\Api). You need to either specify the fully qualified name Cake\ORM\Query in your function prototype, or else use Cake\ORM\Query; at the top of your file.
This site is for discussing CakePHP. If you have questions about the Cake ORM, we can help. But this is not likely to be a good place to get much in the way of unbiased opinions about the rest.