Added check condition before making api call