information and reputation from users with steem api

in #steemdev6 years ago (edited)

hey steemians,

I'm today goin to write them again about steemit api but this time i will used a code which should be placed as the main tutorial because the information that this provides is quite important for the simple fact that information it return is use in other codes as we will see below the code is the next


steem.api.getAccounts(['ederaleng'], function(err, result) {
console.log(result[0])
});

this code gives us all the information of an account from the point of record date until the last movements in the we can find information as id that has our steemit account, reputation , balances, witnesses and many other information.in this code not only can we place a single account we can add as many as we want since as you can see this in an array of names this allows us to obtain more information in a single query although for the moment we will only use one by the simple echo is that it is a lot of information as I said the one that returns is many and we want to see with a single account which is the main information that this provides.

if we run the code you can see a lot of information not place it for the simple fact that it is many informaction and it would take the whole post reviewing each of the sections that this returns us. but for this tutorial we will not only see this, but we will also apply the code provided by this one to get the reputation that we have within the platform for this we will use the following code.


var reputation = steem.formatter.reputation(Reputation);
console.log(reputation);

I said that the code that we apply at the beginning gives us enough information that we can use within other codes this is one of these since to extract the reputation of a user it is necessary a series of numbers they are inside of the JSON that returns in the function that we apply at the beginning. if we apply the necessary code as we will see below and enter deeper into the JSON and keep within a variable the numbers of the reputation this will provera the amount of reputation with which we have at the time of consultation.


steem.api.getAccounts(['ederaleng'], function(err, result) {
var reputationN=result[0].reputation
console.log(reputationN)
var reputation=steem.formatter.reputation(reputationN);
console.log(reputation);
});

if we run the code in the console this will give us the following information:


294178574526
47

summarizing the first number is the number that I said was necessary to get the reputation and the next is the exact reputation that people have within the platform. summarizing the first number is the number that I said was necessary to get the reputation and the next is the exact reputation that people have within the platform. We can also check in steemd if the information that return is correct using the keys "Ctrl+f" these open the search engine within the page and if we write "Reputation" we can see that the information that throws is the same as we had in the query.

without more to say I hope you liked my publication and has helped you, thanks for reading.


image source:1

Sort:  

Good luck to you. I am a new steamer so will be learning a lot from you and others

thank you for your comment and then welcome to the boat hahaha

Thank you a lot for welcoming me here

Congratulations! This post has been upvoted from the communal account, @minnowsupport, by ederaleng 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.

Congratulations @ederaleng! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

Award for the number of upvotes

Click on the badge to view your Board of Honor.
If you no longer want to receive notifications, reply to this comment with the word STOP

Do not miss the last announcement from @steemitboard!

Do you like SteemitBoard's project? Then Vote for its witness and get one more award!

Coin Marketplace

STEEM 0.30
TRX 0.12
JST 0.034
BTC 63799.64
ETH 3130.40
USDT 1.00
SBD 3.97