how to use the rest api