How to add own api function to Piwik api
For general information about plugin development refer to http://developer.piwik.org/
However if you have any special problem or a question which is not already answerd there, feel free to ask in the forums.