SteemAPI Tutorial How to get User Information ?
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
wow i don't know about this
Glad you found out about it :D
I had no clue about it. Thanks for providing us this knowledge man.
You're welcome :D
Wow this can be a great tool in my learning analytics
Glad you found it useful bud.Feel free to share you're analytics tool with me would be happy to work on that project.
Release the Kraken! You got a 2.66% upvote from @seakraken courtesy of @ajkapss!
Some headie information here lol. Good work.
Congratulations! This post has been upvoted from the communal account, @minnowsupport, by ajkapss from the Minnow Support Project. It's a witness project run by aggroed, ausbitbank, teamsteem, theprophet0, someguy123, neoxian, followbtcnews, and netuoso. The goal is to help Steemit grow by supporting Minnows. Please find us at the Peace, Abundance, and Liberty Network (PALnet) Discord Channel. It's a completely public and open space to all members of the Steemit community who voluntarily choose to be there.
If you would like to delegate to the Minnow Support Project you can do so by clicking on the following links: 50SP, 100SP, 250SP, 500SP, 1000SP, 5000SP.
Be sure to leave at least 50SP undelegated on your account.