You haven't spelled out any kind of problem at all. We have no idea what you need help with. Frankly, from the small code snippet you posted, it doesn't look like you have any idea what you're doing or what you're target application is even supposed to be doing.
You're NEVER going to get a tutorial on using the API in a forum. There's just too much information to convey.
Also, nobody is going to write your code for you. YOU have to do the research on this and YOU have to teach yourself how to use the API. What good would someone writing your app for you do? You still really wouldn't know how it works or why.