Revert "Adjusted API query code"

This reverts commit 47c00665cd2e691cd687d772807a62f0fbf3f588.