added end param in api endpoint to get data