change query to submit job
Implement the rest of the Rest API. Several bug fixes