Well, supposing it is javascript, i suggest you to try
https://www.blockcypher.comThey have a complete set of API calls who lets you do what you are looking for, i hope it is not for annother scam or HYIP program. By the way, what is this language ? or just a pseudo code ?
I know Java/Python, Java prefered.
This site doesn't support Java, only JavaScript.
Any other suggestions?
Get a full node ->
https://en.bitcoin.it/wiki/API_reference_(JSON-RPC)#JavaWhat is that? Didn't got it.
It is bitcoin's secret weapon, a full list of how to use bitcoin in different languages. Untill now it is the only Crypto currency offer this kind of support.
Just look for the language you are looking for and use the examples to start coding.
But in your case, you want an API, so :
https://www.blockcypher.com/dev/bitcoin/?shell#blockJust an example, you will have to read all the documents.