Hey Steemians ,have you ever wondered how websites like steemd.com and steemnow.com are able to display user information in near-real time.
Well today we'll use the Steemit API to do exactly that.We are going to be using jsfiddle if you do not know how to use it i would suggest going to this post .
We are going to be using the following API call
steem.api.getAccounts(['ajkapss'], function(err, result)
Our goal is to perform the following operations.
In order to Get User's latest post we will use the following line of code.
steem.api.getBlogEntries("ajkapss", 9999, 1, function(err, data)
For more detail's regarding how to use the above method please refer to my post on Getting the latest post
In order to get User details we first need to figure out what details are we after.In this post lets try to get the following
| No | Detail's | Description |
|---|---|---|
| 1 | Username | UserName Of the Person on steemit |
| 2 | PostCount | Number Of Posts on steemit |
| 3 | Reputation | Reputation on steemit |
| 4 | Mined | True or False |
| 5 | SBDBalance | SBD Balance on Steemit |
| 6 | VotingPower | You're voting power per 100% vote on steemit |
Once again we are going to be using the following API call
steem.api.getAccounts(['ajkapss'], function(err, result)
An important thing to note when using this API call is that almost all the data which we will get will be in the form of an array stored in the variable result.For me to get the individual details for the user I will have to iterate through the array luckily for us we are only looking for one user so we can just use result[0] as that points to the user ajkapss in the API call
Code needed for implementing
| No | Detail's | Code Needed |
|---|---|---|
| 1 | Username | result[0].username |
| 2 | PostCount | result[0].post_count |
| 3 | Reputation | result[0].reputation |
| 4 | Mined | result[0].mined |
| 5 | SBDBalance | result[0].sbd_balance |
| 6 | VotingPower | result[0].voting_power |
As you can see ,this is very straightforward and does not require much programming experience.If you are interested in having a look at the code and trying it out for yourself here it is .
Sources used