Changes affected API query so that it tests for API publishable
adds logic for APIs that are published or not