Api while loop condition edit