Your syntax for removeLine looks correct, however, I would suggest removing the other things in your code first. Start with calling the Api with a static value. The error could be happening somewhere else (eg you could be removing a line that does not exist)