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