simplify _addApiMethod logic