update demo code to last api version