Using Elgg Api

Hi, I am new to Elgg and I was wondering if anyone can tell me how to start using Elgg API. Say, I would like to return the username. Can anyone give me a sample code for such a function. Including api declaration, etc. I am completely new to this framework and I after studying docs a bit, I am still not sure how to do this. Thanks.