[STEEMIT API] How to retrieve feed
steemit·@mikepicker·
0.000 HBD[STEEMIT API] How to retrieve feed
https://bitspace.no/wp-content/uploads/2016/12/steemit.jpg [Source](https://bitspace.no/wp-content/uploads/2016/12/) # Hi Steemians! This will be a little post that might save developers a bunch of their time. As many of you already know, me and @lino are the creators of the upcoming platform @gaamit dedicated to game developers, so we are leveraging Steemit API's to interact with the blockchain. Steemit API's work very well, but the documentation is quite scarce. One of the basic tasks we had to accomplish is getting, for instance, the feed coming from the "new" section of a particular tag ("gamedev" in our case). Using [steem-js](https://github.com/steemit/steem-js) we first tried with **getState**: ```javascript steem.api.getState('/created/gamedev', function(err, result) { console.log(err, result); }); ``` First thing to notice: **"created"** stands for **"new"** category. This call goes fine, but there is no way of retrieving a certain amount of posts from here. We need something more specific. **Get Discussions By Created** (straight from the [docs](https://github.com/steemit/steem-js/tree/master/doc)) seems the correct one: ```javascript steem.api.getDiscussionsByCreated(query, function(err, result) { console.log(err, result); }); ``` Cool! But, wait.. what "query" parameter stands for? We haven't managed to find a documentation about this parameter, but in the [examples](https://github.com/steemit/steem-js/blob/master/examples/) folders from the GitHub account we managed to find something ([server.js](https://github.com/steemit/steem-js/blob/master/examples/server.js)): ```javascript steem.api.getDiscussionsByActive({ limit: 10, start_author: 'thecastle', start_permlink: 'this-week-in-level-design-1-22-2017' }, function(err, result) { console.log(err, result); }); ``` So now we know something about that "query" parameter. Last thing we need is a way to get feed from "gamedev" tag. We guessed that "tag" would have worked, so we tried it.. and indeed it worked. So, the ultimate call is the following: ```javascript steem.api.getDiscussionsByCreated({ limit: 10, start_author: 'thecastle', start_permlink: 'this-week-in-level-design-1-22-2017', tag: 'gamedev' }, function(err, result) { console.log(err, result); }); ``` Where: - *limit* stands for the number of posts to retrieve - *start_author* is the author of the last post we want to start from **(you must specify also start_permlink!)** - *start_permlink* is the permlink of the last post we want to start from **(you must specify also start_author!)** - *tag* will be "gamedev" in our case You can use the same format for **getDiscussionsByHot** and **getDiscussionsByTrending**. ## Let me know if you can point out some good resources about this topic, so we can share them with the community # Thanks for reading!
👍 gaamit, webdeals, sidwaterman, thenightflier, ilbarone623, ivand83, frick, marcodobrovich, leilaa, djluka14, myours, pablito, matt9301, openspace, fmd, lino, tizswa, zaragast, fraswa, thecryptotrader, stefaniya, claudiop63, pataxis, mikepicker, bhuz, kdcory, cryptonews-ita, wasdswag, nocturnal, vitkolesnik, alketcecaj, chris2jh, azolot,