add the same example using api
fix typo