SteemAPI Tutorial Getting the latest post of a user?

in #steemtutorial6 years ago

Hey Steemians In this post i going to show how we can use the steem API to get the latest post details of a specific user.
We are going to be using jsfiddle if you do not know how to use it i would suggest going to my last post


Apisssss.gif

There are a number of ways to get the users last post, we are going to be using the function

steem.api.getBlogEntries(account,entryid,limit,callback)

As you can see there are 4 parameter(account,entryid,limit,callback).So we can essentially get any single post from the users given we know the entry id for a given post.In this tutorial however i will use entryID as an arbitrary large number so as to get the last post from the user.

Parameter entry

  • account:ajkapss
  • entryid:9999
  • limit:1
  • Code Example

    
    steem.api.getBlogEntries("ajkapss", 9999, 1, function(err, data)
    {
        console.log(err, data[0]);
      var Author=document.createElement('li');
      Author.innerHTML=("Author name :"+data[0].author);
      var permLink=document.createElement('li');//also the title
      permLink.innerHTML=("PermLink :"+data[0].permlink);
      ul.appendChild(Author);
      ul.appendChild(permLink);
    });
    

    Here is the link to the jsfiddle page to view the code

    Sort:  

    Good work. Keep it up👊🏽

    Thanks so much :D

    thanks man, thats cool :)

    Thanks bud appreciate that.

    Good stuff . I would like to learn more about coding. RESPECT

    A good way to start is to follow the link to the jsfiddle page and mess around with things. Try changing the username. See what happens.

    feel free to ask me any questions @fracasgrimm be happy to help you out.

    Thanks a lot glad you enjoyed it.

    Cool info, this is good to know! Not very good at coding, but this is interesting for sure...

    glad you found it interesting bud

    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.

    very nice poste keep going fiend

    Coin Marketplace

    STEEM 0.26
    TRX 0.11
    JST 0.033
    BTC 64777.26
    ETH 3101.53
    USDT 1.00
    SBD 3.84