\[solved\] FTC API Implementation Question \* Feathercoin web API - FAQ
-
Hey guys, I’ll have some time this weekend so I figured I’d try and figure something out and maybe learn a thing or two. Problem is I’m having some trouble finding documentation.
I want to make a really simple, pretty looking live updating FTC stats page. Only problem is I have no idea what’s the easiest way to go about calling on the data. jQuery? PHP? Ajax? Is there a way to use it in HTML5 that’s simple and clean?
Just let me know what path to take!
-
Because of its inbuilt JSON functions I would say .php is probably the easiest method to fetch data from the Feathercoin API.
You would then use HTML to display this data to the user.This is basically the method I used for the Pool hashrate charts.
[url=http://feathercoin.com/pools/]http://feathercoin.com/pools/[/url] -
Thanks UKMark!
Gonna drive down the rabbit hole and learn lots of stuff as I have near nil experience with PHP.
By the way, that Pool stats page is incredible. We should be linking to it from our main page.
-
[quote name=“mnstrcck” post=“31712” timestamp=“1382116910”]
Thanks UKMark!Gonna drive down the rabbit hole and learn lots of stuff as I have near nil experience with PHP.
By the way, that Pool stats page is incredible. We should be linking to it from our main page.
[/quote]I think implementing it into the main nav-bar is on Bush’s to-do list, I will remind him when we next chat.
You do not have to use .php, you can use jquery or even write your own JSON parsing functions in vanilla .js, use whatever language you are most comfortable with. I only suggested .php because it seems the simplest way to achieve what you are trying to do.
-
[quote name=“UKMark” post=“31681” timestamp=“1382111187”]
Because of its inbuilt JSON functions I would say .php is probably the easiest method to fetch data from the Feathercoin API.
You would then use HTML to display this data to the user.This is basically the method I used for the Pool hashrate charts.
[url=http://feathercoin.com/pools/]http://feathercoin.com/pools/[/url]
[/quote]Except that approach requires server side execution.
If you went with [url=http://jquery.com/]jQuery[/url] and a tempting engine like [url=http://json2html.com/]json2html[/url] or [url=http://handlebarsjs.com/]Handlebars[/url] there would be no server side dependency, and you could just serve up static HTML from anywhere… including your local file system.
Your template would be trivial to define, and your code would look something like:
[code]
$.ajax(“http://api.feathercoin.com/…”, {success:function(data){ $(“renderDiv”).html(Handlebars.compile($(“myTemplate”)).template(data)); });
[/code]No PHP install required, not even a web server required for this solution.
-
Thanks guys. Kevlar, JSON2HTML looks like a winner. I can totally do this.
My main area of “expertise” is pretty looking shit, so this would be well within my grasp.Now I’m off to play!
-
[quote name=“mnstrcck” post=“31747” timestamp=“1382124490”]
Thanks guys. Kevlar, JSON2HTML looks like a winner. I can totally do this.
My main area of “expertise” is pretty looking shit, so this would be well within my grasp.Now I’m off to play!
[/quote]Yeah, I totally recommend it for static data displays. It’s very easy to work with once you get the initial concepts down. It’s very much geared towards reducing the amount of HTML you have to write, where as Handlebar/Mustache is geared towards making your HTML templates look like HTML. Either is a fine solution, but the lack of server side dependencies (and my one line example) should make doing this really trivial.
-
Rough plan for final implementation.
[url=http://i.imgur.com/wd3SO5B.jpg]http://i.imgur.com/wd3SO5B.jpg[/url]
Now the hard part begins…
-
[quote name=“mnstrcck” post=“31755” timestamp=“1382132135”]
Rough plan for final implementation.[url=http://i.imgur.com/wd3SO5B.jpg]http://i.imgur.com/wd3SO5B.jpg[/url]
Now the hard part begins…
[/quote]Nice graphics, how did you make that, are you good at design in general?
-
[quote name=“chrisj” post=“31756” timestamp=“1382132409”]
[quote author=mnstrcck link=topic=4095.msg31755#msg31755 date=1382132135]
Rough plan for final implementation.[url=http://i.imgur.com/wd3SO5B.jpg]http://i.imgur.com/wd3SO5B.jpg[/url]
Now the hard part begins…
[/quote]Nice graphics, how did you make that, are you good at design in general?
[/quote]I used Photoshop. I guess if you like it, then I’m ok at design :) If you ever need help, feel free to ask.
-
[quote name=“mnstrcck” post=“31757” timestamp=“1382132505”]
[quote author=chrisj link=topic=4095.msg31756#msg31756 date=1382132409]
[quote author=mnstrcck link=topic=4095.msg31755#msg31755 date=1382132135]
Rough plan for final implementation.[url=http://i.imgur.com/wd3SO5B.jpg]http://i.imgur.com/wd3SO5B.jpg[/url]
Now the hard part begins…
[/quote]Nice graphics, how did you make that, are you good at design in general?
[/quote]I used Photoshop. I guess if you like it, then I’m ok at design :) If you ever need help, feel free to ask.
[/quote]Honestly for that? I’d skip the template engine and just use JQuery.
Revised oneliner:
[code]
$.ajax(“http://api.feathercoin.com/…”, {success:function(data){
$(“priceDiv”).html(data.price);
$(“marketCapDiv”).html(data.marketcap);
});
[/code] -
Thanks Kevlar. I’m going to wrap my head around implementing this now.