API History Format Request

Development & Technical discussion about Timekoin.
Forum rules
Bug Collecting Database is Click Here
GitHub Account is Click Here
Post Reply
Posts: 404
Joined: Thu Jun 21, 2012 5:18 pm

API History Format Request

Post by warmach »

I am working with the API to get transaction history for a public key. The API returns a string of data and after each data element, there is a counter added.

For Example


I understand the reason for this going in, but it makes it more difficult to parse the string. The easiest way to parse the entire string would be to split it out by "---END" into an array. Each array item would then be just one record and you could parse that easily. Ideally, it could be an element of the record, i.e. ---RECORD=1.....RECORD=2.....RECORD=3

Are there any others who use the API "pk_history" function? Do you guys agree or am I being too picky?
Posts: 6
Joined: Tue Feb 18, 2014 1:47 pm

Re: API History Format Request

Post by JohnES »

I agree, the API is a little difficult to parse at first glance. It would be nice if the API used a better understood message format like JSON. PHP has built-in JSON support, so it would be pretty straight-forward to build out the necessary objects and serialize them as JSON using json_encode(). Most other languages have some JSON support as well, so this would eliminate the need for custom parsing routines in most situations.
User avatar
Posts: 81
Joined: Wed Jun 20, 2012 2:13 pm

Re: API History Format Request

Post by tiker »

I was going to copy api.php and modify it to go the XML route. JSON would work as well I guess.
Post Reply