Skip to content

Available Methods

dez1337 edited this page Oct 15, 2017 · 30 revisions

The central entry point to work with the API methods shown below is a SteemJ instance.

You can simply configure and create an instance like this.

SteemJConfig myConfig = SteemJConfig.getInstance();
myConfig.setDefaultAccount(new AccountName("steemj"));

try {
   // SteemJ will automatically pick up the configuration made above.
   SteemJ steemJ = new SteemJ();
   [...]

Please notice that a person running a node can activate or deactive specific plugins depending on hardware resources or personal needs. All API methods shown in this article are supported by SteemJ, but will only work if the plugins are enabled for the node you are connected to.

You can check which plugins are enabled by a node by connected SteemJ against it and executing the getApiByName method.

Integer apiNumber = steemJ.getApiByName("follow_api");

The code above will try to get the API id for the follow_api. If the follow_plugin is disabled, the apiNumber object will be null, otherwise the API id is returned.

TOC

Database API

Market History API

The market_history_api covers all api calls related to the internal Steem market.

Market-History-API TOC

getTicker

Use this method to receive statistic values of the internal SBD:STEEM market for the last 24 hours.

As this method does not require parameters, the call is quite simply.

MarketTicker marketTicker = steemJ.getTicker();

The call above returns a MarketTicker object providing information about the:

  • Latest price
  • Highest price
  • Lowest price
  • Steem volume,
  • SBD volume,
  • Change in percent

For the last 24 hours.

Back to Market-History-API TOC | Back to TOC

getVolume

Use this method to get the SBD and Steem volume that has been traded in the past 24 hours at the internal SBD:STEEM market

MarketVolume marketVolume = steemJ.getVolume();

As shown above the method has no parameter too and also the returned volumes are equal to the one returned by the getTicker method. The only difference is that the getTicker method returns price information in addition.

Back to Market-History-API TOC | Back to TOC

getOrderBook

Back to Market-History-API TOC | Back to TOC

getTradeHistory

Back to Market-History-API TOC | Back to TOC

getRecentTrades

Back to Market-History-API TOC | Back to TOC

getMarketHistory

Back to Market-History-API TOC | Back to TOC

getMarketHistoryBuckets

Back to Market-History-API TOC | Back to TOC

Account by key

History API

Block Info

Block statistics

Follow API

The follow_api covers all api calls related to blogs, feeds, and followers.

Follow-API TOC

getFollowers

Use this method to get a list of account names which the following account is followed by.

Steem offers some filter creteria for this method. As usual, Steem allows to limit the number of results using the limit parameter. Beside that it is also possible to differ between mutes and follows using the type parameter. The last filter option is the startFollower parameter which can be used to only receive accounts that the following account followed or muted after he or she followed or muted the startFollower account.

List<FollowApiObject> followers = steemJ.getFollowers(new AccountName("dez1337"),
                new AccountName("good-karma"), FollowType.BLOG, (short) 10);

The sample above will return up to 10 account names dez1337 is followed by (FollowType.Blog) since good-karma has followed dez1337.

List<FollowApiObject> followers = steemJ.getFollowers(new AccountName("dez1337"),
                new AccountName(""), FollowType.BLOG, (short) 10);

The sample above will return up to 10 account names dez1337 is followed by.

Back to Follow-API TOC | Back to TOC

getFollowing

Use this method to get a list of account names which the follower account follows.

Steem offers some filter creteria for this method. As usual, Steem allows to limit the number of results using the limit parameter. Beside that it is also possible to differ between mutes and follows using the type parameter. The last filter option is the startFollowing parameter which can be used to only receive accounts that the follower account followed or muted after he or she followed or muted the startFollowing account.

List<FollowApiObject> following = steemJ.getFollowing(new AccountName("dez1337"),
                new AccountName("good-karma"), FollowType.BLOG, (short) 10);

The sample above will return up to 10 account names dez1337 has followed (FollowType.Blog) after he followed good-karma.

List<FollowApiObject> following = steemJ.getFollowing(new AccountName("dez1337"),
                new AccountName(""), FollowType.BLOG, (short) 10);

The sample above will return up to 10 account names dez1337 is following.

Back to Follow-API TOC | Back to TOC

getFollowCount

Use this method to get the amount of accounts following the given account and the number of accounts this account follows.

FollowCountApiObject followCount = steemJ.getFollowCount(new AccountName("dez1337"));

The sample call above will return the number of accounts following dez1337 and the number of accounts dez1337 is following.

Back to Follow-API TOC | Back to TOC

getBlogEntries

Use this method to get the blog entries of the given author based on the given coniditions.

Each blog entry of an author (resteemed or posted on his/her own) has an entryId, while the entryId starts with 0 for the first blog entry and is increment by 1 for each resteem or post of the author.

Steem allows to use the entryId as a search criteria: The first entry of the returned list is the blog entry with the given entryId. Beside that, the limit can be used to limit the number of results.

List<BlogEntry> blogEntries = steemJ.getBlogEntries(new AccountName("dez1337"), 5, (short) 2);

So if the method is called with entryId set to 5 and the limit is set to 2, the returned list will contain 2 entries: The first one is the blog entry with entryId of 5, the second one has the entryId 4.

If the entryId is set to 0, the first returned item will be the latest blog entry of the given author.

List<BlogEntry> blogEntries = steemJ.getBlogEntries(new AccountName("dez1337"), 0, (short) 2);

So if a user has 50 blog entries and this method is called with an entryId set to 0 and a limit of 2, the returned list will contain the blog entries with the entryIds 50 and 49.

Back to Follow-API TOC | Back to TOC

getBlog

This method is like the getBlogEntries method, but instead of the author and the permlink, it contains the whole content of the post.

List<CommentBlogEntry> blog = steemJ.getBlog(new AccountName("dez1337"), 0, (short) 10);

The sample above returns the last 10 blog entries of dez1337 blog.

Back to Follow-API TOC | Back to TOC

getFeedEntries

This method is like the getBlogEntries method, but instead of returning blog entries, the getFeedEntries method returns the feed of the given account.

List<FeedEntry> feedEntries = steemJ.getFeedEntries(new AccountName("dez1337"), 0, (short) 100);

So that the sample above returns the latest 100 posts of dez1337s feed.

Back to Follow-API TOC | Back to TOC

getFeed

This method is like the getBlog method, but instead of returning a blog, the method will return the feed of the given account.

List<CommentFeedEntry> feed = steemJ.getFeed(new AccountName("dez1337"), 0, (short) 100);

So that the sample above returns the latest 100 posts of dez1337s feed including the whole content of each post.

Back to Follow-API TOC | Back to TOC

getAccountReputations

This next method can be used to get the reputation for one or more accounts.

The method requires an account name pattern and the number of results Steem should return.

List<AccountReputation> accountReputations = steemJ
                .getAccountReputations(new AccountName("dez1337"), 0);

The method returns an account name that matches the most with the given account name pattern and the reputation of this account. The sample above would return the reputation from dez1337, because this account has a 100% match with the given account name pattern "dez1337".

List<AccountReputation> accountReputations = steemJ
                .getAccountReputations(new AccountName("dez1337"), 1);

This sample would return the reputation for dez1337, but also add a second account dez243 to the result, because dez243 is the account that has the second most accordance with the given account name pattern.

Back to Follow-API TOC | Back to TOC

getRebloggedBy

Use this method to find out, which user have resteemed a specific post.

The method requires the author of the post and its permanent link, so a method call could look like this:

List<AccountName> accountNames = steemJ.getRebloggedBy(new AccountName("dez1337"),
                "steemj-v0-2-6-has-been-released-update-11");

The result of this call is a list of account names which have resteemed the given post.

Back to Follow-API TOC | Back to TOC

getBlogAuthors

Use this method to find out, how many blog entries of which authors have been published by an account.

The method only requires an account name of the blog owner to analzse, so a method call could look like this.

List<PostsPerAuthorPair> blogAuthors = steemJ.getBlogAuthors(new AccountName("dez1337"));

And would return a list of pairs, while earch pair consists of an author name and the number of blog entries that dez1337 has resteemed from this author.

ausbitbank: 1
good-karma: 3
...

In this case two pairs have been returned, providing the information that dez1337 has currently resteemed one post from ausbitsbank in his blog history, and three posts from good-karma.

Back to Follow-API TOC | Back to TOC

Clone this wiki locally