some code to use the api