BURST API
-
Hey, i was fiddling with API using NXT documentation and happened upon one thing that personaly would be great to me and probable save some trafic for the server.
Basically there is request getTrades that would fetch all trades for entered asset id. Now in NXT docs there is also variable timestamp so you could set what earliest block you want (maybe i all ready have cain and only interested to see if there is something new). Sadly this timestamp variable doesnt work on burst api :(
EDIT: Figured a way to lessen the response size, but it needs some jugling and caching on my side.
-
@LithStud Can you kindly give me the link of the API docs you are reading please
-
-
@LithStud thx ;)
-
@ccminer no problem :)
-
Moved to Help&Support ... maybe we need a Development sub/category...
-
@luxe depends how many will discuss it there :)
-
@LithStud Some categories just have too many threads compared to others, indicates that our categories are not perfect chosen yet.
-
@luxe nobody is perfect :) all in all i would consider this forum fairly well organized :)
-
Now in NXT docs there is also variable timestamp so you could set what earliest block you want
timestamp is not the block height ... in what way it does not work?! just ignored?
-
@luxe yea there is no such variable in test api list and if added to url just ignores it.
And yes i know time stam is not block height :P but it measures time and time is important in Tx logs (as there can be several per block but with different timing) ;)
-
@LithStud Ok, i looked at api, trades are sorted by last first, so you have to figure out, how to solve your problem by paging, you have to use firstIndex and lastIndex to get trades not all in one :-( I fear the API is only made to fit the needs of current GUI ... so there may be a lot of usecases where it is not perfect and you have to build a workaround. I also ran into such usecases.
What exactly you want to request? Why do you need a timestamp?!
-
@luxe you cant paginate it :( since you have no reference where that last tx is in this point of time (it could have been no new tx or it could have been 100). well since api was from NXT i just suppose there should of been this variable available but for unknown reason someone removed it.
as i said that since you cant predict where is the last tx is your forced to fetch whole tx log again i want just this implementation as is documented on nxt (http://wiki.nxtcrypto.org/wiki/The_Nxt_API#Get_Trades) look into possible variables ;) this way i can just record last tx timestamp and on later calls append timestamp so it would be the earliest tx in response (no more huge response if there is hundreds of tx).
I want to make a website that tracks trades for a certain asset (mine and i suppose N.E.W.S since i made his charts :D) so you could imagine how many api calls there would be if every time some chap visits it it has to download all tx (and it will grow with time!) same thing applies to wallet client since it refreshes whole tx log (optimization in these things is a good insight for future).
-
@LithStud I get your point, but for example, just get lastest 10 trades, and than the next 10 and than the next 10, until you get a trade you already had. Not that comfortable but like i said, sometimes a workaround is needed.
-
@luxe well i can do that but then again i have to every of those to scan if we got to end if not repeat (the more repeated api calls the bigger chance for something to go horribly wrong) :)
-
@LithStud Well, just try to help ... as long as you do not implement it yourself, api will not change any time soon i guess :-)
-
@luxe sigh :D at least give a stern look and maybe some verbal select words to the one who removed it in the first place ;) (and since its a webpage all calls gonna go to the online wallet :P )
-
@LithStud The API of online wallet can be disabled at some point, if it has too much load. So better do not rely on that. But sure a php webhosting can not run a own wallet.
-
@luxe exactly :) i do plan to get my own rented server space where i can install whatever i desire but thats in future once i start optimizing and spreading out my project :)
-
Just as a note to anyone else looking for the API docs, the nxtcrypto.org mentioned above seems to be gone. I found the docs at https://nxtwiki.org/wiki/The_Nxt_API.
