BURST API
-
@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.
-
https://nxtwiki.org/wiki/The_Nxt_API_Examples#Send_Money
how does this work if your site is hosted? you have to know IP of your wallet?
i plan a site where i used shared hosting, how or where do i send the http Post?
http://localhost:7876/nxt?
requestType=sendMoney&
secretPhrase=IWontTellYou&
recipient=NXT-4VNQ-RWZC-4WWQ-GVM8S&
amountNQT=100000000&
feeNQT=100000000&
deadline=60
-
@falconCoin If your wallet isn't on the same machine that you're making the request from, you would need to configure your wallet settings to allow API connections from other hosts (if possible, you should configure it only to allow connections from the host you'll be making requests from, for security). You'll also need to configure it to listen on network interfaces other than localhost.
If you look in the conf/ subdirectory of the wallet source, you'll find a file called nxt-default.properties. You can override variables in that file by creating another file called nxt.properties and putting your configurations in there. I think the relevant variables are nxt.allowedBotHosts and nxt.apiServerHost.
Also, you want to use the URL http://<hostname>:8125/burst, and not port 7876/nxt.
Those are my learnings from playing with some API calls over the weekend, anyway. :) Other devs probably know more.
-
@zyzzyva wow they did not make it easy did they! lol PM if you can with some details please
-
@falconCoin or you make your own api that would run on same localhost as wallet :) tho you would still need to make sure it has access to wallet :D
-
@LithStud thanks again... doesnt seem like an easy task compared to some other api's
-
@falconCoin i wouldnt say its that much harder than others :) you still need somewhere to configure who can access the api.