Update api.rst

example for script(code) was incorrect