__________     __ __     __  _______    ________
  / ____/ __ \   / // /    / / / /  _/ |  / / ____/
 / / __/ / / /  / // /_   / /_/ // / | | / / __/
/ /_/ / /_/ /  /__  __/  / __  // /  | |/ / /___
\____/\____/     /_/    /_/ /_/___/  |___/_____/

 --- A GOPHER-LIKE INTERFACE FOR HIVE BLOCKCHAIN ---

SteemAPI Tutorial How to get User Information ?

BY: @ajkapss | CREATED: March 4, 2018, 11:10 a.m. | VOTES: 106 | PAYOUT: $6.10 | [ VOTE ]

Hey Steemians ,have you ever wondered how websites like steemd.com and steemnow.com are able to display user information in near-real time.

[IMAGE: https://steemitimages.com/DQmTZk2jTVAm4ZPjFEtp7mXHry9NZcMF4KcMkPWWFhZaZH7/DQmTZk2jTVAm4ZPjFEtp7mXHry9NZcMF4KcMkPWWFhZaZH7.gif]

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.

Get Users Latest Post

Get User Details Like Reputation,Postcount,etc

 
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

API doccumentation

TAGS: [ #steemstem ] [ #steemjs ] [ #steemdev ] [ #programming ] [ #api ]

Replies

@ayushthedreamer | March 4, 2018, 11:36 a.m. | Votes: 1 | [ VOTE ]

Wow this can be a great tool in my learning analytics

@ajkapss | March 4, 2018, 11:49 a.m. | Votes: 5 | [ VOTE ]

Glad you found it useful bud.Feel free to share you're analytics tool with me would be happy to work on that project.

@aman2017 | March 4, 2018, 11:44 a.m. | Votes: 2 | [ VOTE ]

wow i don't know about this

@ajkapss | March 4, 2018, 11:52 a.m. | Votes: 5 | [ VOTE ]

Glad you found out about it :D

@lucky17 | March 4, 2018, 12:10 p.m. | Votes: 1 | [ VOTE ]

I had no clue about it. Thanks for providing us this knowledge man.

@ajkapss | March 4, 2018, 1:29 p.m. | Votes: 5 | [ VOTE ]

You're welcome :D

@seakraken | March 4, 2018, 3:22 p.m. | Votes: 0 | [ VOTE ]

Release the Kraken! You got a 2.66% upvote from @seakraken courtesy of @ajkapss!

@asonintrigue | March 4, 2018, 10:22 p.m. | Votes: 0 | [ VOTE ]

Some headie information here lol. Good work.

@minnowsupport | March 4, 2018, 10:48 p.m. | Votes: 0 | [ VOTE ]

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.

[ BACK TO TRENDING ] [ BACK TO MENU ]
CMD>