added validations to ensure params are set in the api query