create account

Let‘s develop a Steemit API Wrapper for Java by dez1337

View this thread on: hive.blogpeakd.comecency.com
· @dez1337 ·
$0.58
Let‘s develop a Steemit API Wrapper for Java
Hay Steemers,

I would like to provide some new tools to the Steemit univers and as you may have noticed due to my posts here, my preferred programming language is Java. But, so far there is no kind of API Wrapper for Steemit which makes it pretty hard to develop new tools to me.

![WRAPPER](https://kemptechnologies.com/blog/wp-content/uploads/2015/07/JAVA-API-Wrapper.png)
[Source](https://kemptechnologies.com/blog/wp-content/uploads/2015/07/JAVA-API-Wrapper.png)

Because of that, I’ve spend some time to do a short proof of concept which you can find later in this article. My main question for now is, are there people out there that are also interested in a Java API for Steemit or are there even people who would like to contribute? If so, please leave a comment right here so I know if the work is worth it. Please keep in mind that this API wrapper could also be usefull for android apps.

If I feel like this project is worth the work, I will create a new GitHub repository for the project so everybody could help to make this small project a success.

# Proof of Concept
For this proof of concept I’ve used the “tyrus-standalone-client” for the websocket communication in Java. So far, this is the only dependency that is needed so far, which makes the pom pretty easy to understand:

```XML
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>dez1337.steemit.com</groupId>
	<artifactId>steemit-api-wrapper</artifactId>
	<version>1.0-SNAPSHOT</version>
	<name>Steemit Java API Wrapper</name>
	<url>http://www.steemit.com/@dez1337</url>

	<dependencies>
		<dependency>
			<groupId>org.glassfish.tyrus.bundles</groupId>
			<artifactId>tyrus-standalone-client</artifactId>
			<version>1.13</version>
		</dependency>
	</dependencies>
	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.6.0</version>
				<configuration>
					<source>${java.version}</source>
					<target>${java.version}</target>
				</configuration>
			</plugin>
		</plugins>
	</build>
	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

		<java.version>1.8</java.version>
	</properties>
</project>
```

After that I’ve created one simple Java class that only do one websocket request. Here is the code of this class:

```Java
package dez.steemit.com;

import java.io.IOException;
import java.net.URI;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

import javax.websocket.ClientEndpointConfig;
import javax.websocket.Endpoint;
import javax.websocket.EndpointConfig;
import javax.websocket.MessageHandler;
import javax.websocket.Session;

import org.glassfish.tyrus.client.ClientManager;


public class JavaAPIWrapper {
	private static CountDownLatch messageLatch;
	private static final String SENT_MESSAGE = "{\"jsonrpc\": \"2.0\", \"params\": [\"database_api\", \"get_account_count\", [1]], \"id\": 1 \"method\": \"call\"}";

	public static void main(String[] args) {
		try {
			messageLatch = new CountDownLatch(1);

			final ClientEndpointConfig cec = ClientEndpointConfig.Builder.create().build();

			ClientManager client = ClientManager.createClient();
			client.connectToServer(new Endpoint() {

				@Override
				public void onOpen(Session session, EndpointConfig config) {
					try {
						session.addMessageHandler(new MessageHandler.Whole<String>() {

							@Override
							public void onMessage(String message) {
								System.out.println("Received message: " + message);
								messageLatch.countDown();
							}
						});
						session.getBasicRemote().sendText(SENT_MESSAGE);
					} catch (IOException e) {
						e.printStackTrace();
					}
				}
			}, cec, new URI("wss://node.steem.ws"));
			messageLatch.await(100, TimeUnit.SECONDS);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}

```

If you run the application, it print something like this:

> Received message: {"id":1,"result":121305}

So everything is working as expected!

At this point I have to say thanks to @aglo whose article showed me how to format the websocket requests and also a huge thanks to @xeroc and @jesta for providing the service “node.steem.ws”.

# Summary
Please do not forget to give me some feedback for the idea and make sure to follow me by pressing the button below, so you’ll never miss new posts!

[![alt text](http://www.vector-eps.com/wp-content/gallery/follow-me-twitter-buttons-and-icons/follow-me-twitter-buttons-and-icons6.jpg)](https://steemit.com/@dez1337)
[Source](http://www.vector-eps.com/wp-content/gallery/follow-me-twitter-buttons-and-icons/follow-me-twitter-buttons-and-icons6.jpg)


Thank you and best regards!
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 37 others
properties (23)
authordez1337
permlinklet-s-develop-a-steemit-api-wrapper-for-java
categorysteem
json_metadata{"tags":["steem","steemit","esteem","programming"],"users":["aglo","xeroc","jesta"],"image":["https://kemptechnologies.com/blog/wp-content/uploads/2015/07/JAVA-API-Wrapper.png","http://www.vector-eps.com/wp-content/gallery/follow-me-twitter-buttons-and-icons/follow-me-twitter-buttons-and-icons6.jpg"],"links":["https://kemptechnologies.com/blog/wp-content/uploads/2015/07/JAVA-API-Wrapper.png","https://steemit.com/@dez1337","http://www.vector-eps.com/wp-content/gallery/follow-me-twitter-buttons-and-icons/follow-me-twitter-buttons-and-icons6.jpg"],"app":"steemit/0.1","format":"markdown"}
created2016-12-21 21:16:48
last_update2016-12-21 21:16:48
depth0
children16
last_payout2017-01-21 22:05:57
cashout_time1969-12-31 23:59:59
total_payout_value0.465 HBD
curator_payout_value0.113 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length4,881
author_reputation20,544,257,521,749
root_title"Let‘s develop a Steemit API Wrapper for Java"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id2,058,547
net_rshares7,785,997,527,810
author_curate_reward""
vote details (101)
@alketcecaj ·
$0.09
Hi @dez1337 . Thanks for sharing this. I also program in Java and was looking for something like this. But this post is 9 months old. Do you have some more updated posts on how to build a Java wrapper for Steemit API ?
👍  
properties (23)
authoralketcecaj
permlinkre-dez1337-let-s-develop-a-steemit-api-wrapper-for-java-20170915t084025874z
categorysteem
json_metadata{"tags":["steem"],"users":["dez1337"],"app":"steemit/0.1"}
created2017-09-15 08:40:24
last_update2017-09-15 08:40:24
depth1
children2
last_payout2017-09-22 08:40:24
cashout_time1969-12-31 23:59:59
total_payout_value0.068 HBD
curator_payout_value0.022 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length218
author_reputation2,409,013,484,223
root_title"Let‘s develop a Steemit API Wrapper for Java"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id14,946,021
net_rshares32,866,270,654
author_curate_reward""
vote details (1)
@dez1337 ·
$0.19
Hay @alketcecaj,

thank you for your interest - Just check my blog - This project has grown a lot since this post :) 

Best regards!
👍  ,
properties (23)
authordez1337
permlinkre-alketcecaj-re-dez1337-let-s-develop-a-steemit-api-wrapper-for-java-20170917t102740366z
categorysteem
json_metadata{"tags":["steem"],"users":["alketcecaj"],"app":"steemit/0.1"}
created2017-09-17 10:27:36
last_update2017-09-17 10:27:36
depth2
children1
last_payout2017-09-24 10:27:36
cashout_time1969-12-31 23:59:59
total_payout_value0.157 HBD
curator_payout_value0.029 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length132
author_reputation20,544,257,521,749
root_title"Let‘s develop a Steemit API Wrapper for Java"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id15,124,936
net_rshares72,673,824,723
author_curate_reward""
vote details (2)
@alketcecaj ·
$0.08
Thank you @dez1337! Java is my favorite language, I'm glad to find a wrapper in Java
👍  
properties (23)
authoralketcecaj
permlinkre-dez1337-re-alketcecaj-re-dez1337-let-s-develop-a-steemit-api-wrapper-for-java-20170917t121615090z
categorysteem
json_metadata{"tags":["steem"],"users":["dez1337"],"app":"steemit/0.1"}
created2017-09-17 12:16:21
last_update2017-09-17 12:16:21
depth3
children0
last_payout2017-09-24 12:16:21
cashout_time1969-12-31 23:59:59
total_payout_value0.078 HBD
curator_payout_value0.005 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length84
author_reputation2,409,013,484,223
root_title"Let‘s develop a Steemit API Wrapper for Java"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id15,131,670
net_rshares32,866,270,654
author_curate_reward""
vote details (1)
@alketcecaj ·
$0.30
Hi @dez1337 ! Thanks for sharing your project with us ! Can I use it for collecting data on steemit users ? If yes how can I do that? I'm looking at the github repo but there are no examples on how to query the Steemit API for obtaining data on number of users and number of posts in a given date.
👍  ,
properties (23)
authoralketcecaj
permlinkre-dez1337-let-s-develop-a-steemit-api-wrapper-for-java-20180227t085518010z
categorysteem
json_metadata{"tags":["steem"],"users":["dez1337"],"app":"steemit/0.1"}
created2018-02-27 08:55:18
last_update2018-02-27 08:55:18
depth1
children0
last_payout2018-03-06 08:55:18
cashout_time1969-12-31 23:59:59
total_payout_value0.228 HBD
curator_payout_value0.071 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length297
author_reputation2,409,013,484,223
root_title"Let‘s develop a Steemit API Wrapper for Java"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id40,818,462
net_rshares53,052,252,413
author_curate_reward""
vote details (2)
@biophil ·
The more tools the better!

As @krnel mentioned, there are some pretty solid tools for python already with @xeroc's piston.steem and @furion's [steemtools](https://steemit.com/steemtools/@furion/ann-steemtools-a-high-level-python-library-for-steem).
👍  
properties (23)
authorbiophil
permlinkre-dez1337-let-s-develop-a-steemit-api-wrapper-for-java-20161221t220648919z
categorysteem
json_metadata{"tags":["steem"],"users":["krnel","xeroc","furion"],"links":["https://steemit.com/steemtools/@furion/ann-steemtools-a-high-level-python-library-for-steem"]}
created2016-12-21 22:06:48
last_update2016-12-21 22:06:48
depth1
children0
last_payout2017-01-21 22:05:57
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length249
author_reputation45,223,914,794,461
root_title"Let‘s develop a Steemit API Wrapper for Java"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id2,058,839
net_rshares7,877,109,255
author_curate_reward""
vote details (1)
@kimterje83 ·
$0.11
is it possible to make a  stemmit time Watch Movies and TV Shows instantly
poppcorn time + steemit = ? dtube +  bot searting tv series using ,watchfree.io putlocker.is ,movieonline.io, powered by steemit  tool that allows you to play hundreds of movies and series ,

steemit.time. powered by stemmit 

No more downloads hassle! The best movies & TV shows, for free! Directly on Stemmit Time Online in HD + subtitles, with Torrents Time Engine™
👍  ,
properties (23)
authorkimterje83
permlinkre-dez1337-let-s-develop-a-steemit-api-wrapper-for-java-20170819t221516007z
categorysteem
json_metadata{"tags":["steem"],"app":"steemit/0.1"}
created2017-08-19 22:15:15
last_update2017-08-19 22:15:15
depth1
children1
last_payout2017-08-26 22:15:15
cashout_time1969-12-31 23:59:59
total_payout_value0.083 HBD
curator_payout_value0.025 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length443
author_reputation77,011,462,614
root_title"Let‘s develop a Steemit API Wrapper for Java"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id12,298,880
net_rshares30,458,035,024
author_curate_reward""
vote details (2)
@dez1337 ·
$0.24
:D Sadly the Steem blockchain is not made to host videos, but the idea is nice in general :D :)
👍  ,
properties (23)
authordez1337
permlinkre-kimterje83-re-dez1337-let-s-develop-a-steemit-api-wrapper-for-java-20170820t192555867z
categorysteem
json_metadata{"tags":["steem"],"app":"steemit/0.1"}
created2017-08-20 19:25:54
last_update2017-08-20 19:25:54
depth2
children0
last_payout2017-08-27 19:25:54
cashout_time1969-12-31 23:59:59
total_payout_value0.183 HBD
curator_payout_value0.060 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length95
author_reputation20,544,257,521,749
root_title"Let‘s develop a Steemit API Wrapper for Java"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id12,374,020
net_rshares63,872,004,827
author_curate_reward""
vote details (2)
@krnel · (edited)
If you can make, make it, I'm sure it will be highly valued and appreciated. @jesta made a python api for steem, and fabien or fabian made one for javascript.
👍  
properties (23)
authorkrnel
permlinkre-dez1337-let-s-develop-a-steemit-api-wrapper-for-java-20161221t212723531z
categorysteem
json_metadata{"tags":["steem"],"users":["jesta"]}
created2016-12-21 21:27:24
last_update2016-12-21 21:28:15
depth1
children1
last_payout2017-01-21 22:05:57
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length158
author_reputation1,343,547,270,297,082
root_title"Let‘s develop a Steemit API Wrapper for Java"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id2,058,601
net_rshares7,877,109,255
author_curate_reward""
vote details (1)
@dez1337 ·
Hehe, thank you for the feedback. You are right, for sure, but it will be a good amount of work and I am not sure if I can finish it parallel to my normal work :D But I'll give it a try :)
properties (22)
authordez1337
permlinkre-krnel-re-dez1337-let-s-develop-a-steemit-api-wrapper-for-java-20161221t212932028z
categorysteem
json_metadata{"tags":["steem"]}
created2016-12-21 21:29:33
last_update2016-12-21 21:29:33
depth2
children0
last_payout2017-01-21 22:05:57
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length188
author_reputation20,544,257,521,749
root_title"Let‘s develop a Steemit API Wrapper for Java"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id2,058,615
net_rshares0
@realskilled ·
$0.06
Hi @dez1337,

Thanks for sharing this code!

I'm looking for an API that allows me to create content (POSTs). I have been reading the documentation and it seems that we can only retrieve information or just create a comments or up-vote.

I wonder if you could point me to some API that allows creating POST in steemit.com.

Thanks,

@realskilled
👍  ,
properties (23)
authorrealskilled
permlinkre-dez1337-let-s-develop-a-steemit-api-wrapper-for-java-20171008t214315143z
categorysteem
json_metadata{"tags":["steem"],"users":["dez1337","realskilled"],"app":"steemit/0.1"}
created2017-10-08 21:43:12
last_update2017-10-08 21:43:12
depth1
children5
last_payout2017-10-15 21:43:12
cashout_time1969-12-31 23:59:59
total_payout_value0.049 HBD
curator_payout_value0.014 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length345
author_reputation-65,196,368,224
root_title"Let‘s develop a Steemit API Wrapper for Java"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id17,141,446
net_rshares26,884,172,150
author_curate_reward""
vote details (2)
@dez1337 ·
$0.14
Hay @realskilled ,

Please checkout my blog and also the latest update post of SteemJ 0.4.0.

The version allows you to post using:

```Java
steemj.createPost(.....)
```

Let me know if you face an issue 😊👍
👍  
properties (23)
authordez1337
permlinkre-realskilled-re-dez1337-let-s-develop-a-steemit-api-wrapper-for-java-20171009t185557752z
categorysteem
json_metadata{"tags":["steem"],"users":["realskilled"],"app":"steemit/0.1"}
created2017-10-09 18:56:00
last_update2017-10-09 18:56:00
depth2
children4
last_payout2017-10-16 18:56:00
cashout_time1969-12-31 23:59:59
total_payout_value0.105 HBD
curator_payout_value0.034 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length206
author_reputation20,544,257,521,749
root_title"Let‘s develop a Steemit API Wrapper for Java"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id17,222,212
net_rshares57,736,236,017
author_curate_reward""
vote details (1)
@realskilled ·
$0.06
Hi @dez1337
Thanks for your comment. 
The point is that I need to figure out how could I use this from PHP :)
A tricky point, right?
👍  
properties (23)
authorrealskilled
permlinkre-dez1337-re-realskilled-re-dez1337-let-s-develop-a-steemit-api-wrapper-for-java-20171009t190259825z
categorysteem
json_metadata{"tags":["steem"],"users":["dez1337"],"app":"steemit/0.1"}
created2017-10-09 19:03:03
last_update2017-10-09 19:03:03
depth3
children3
last_payout2017-10-16 19:03:03
cashout_time1969-12-31 23:59:59
total_payout_value0.050 HBD
curator_payout_value0.008 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length132
author_reputation-65,196,368,224
root_title"Let‘s develop a Steemit API Wrapper for Java"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id17,222,733
net_rshares24,301,795,949
author_curate_reward""
vote details (1)
@screenname ·
Re: Let‘s develop a Steemit API Wrapper for Java
<p>This post has been ranked within the top 50 most undervalued posts in the second half of Dec 21. We estimate that this post is undervalued by $6.43 as compared to a scenario in which every voter had an equal say.</p> 
<p>See the full rankings and details in <a href="https://steemit.com/curation/@screenname/the-daily-tribune-most-undervalued-posts-of-dec-21---part-ii">The Daily Tribune: Dec 21 - Part II</a>. You can also read about some of our methodology, data analysis and technical details in <a href="https://steemit.com/curation/@screenname/introducing-the-daily-tribune-most-undervalued-posts-of-nov-04---part-i">our initial post</a>.</p>
<p>If you are the author and would prefer not to receive these comments, simply reply "Stop" to this comment.</p>
👍  
properties (23)
authorscreenname
permlinkre-let-s-develop-a-steemit-api-wrapper-for-java-20161222t012156
categorysteem
json_metadata"{"replyto": "@dez1337/let-s-develop-a-steemit-api-wrapper-for-java"}"
created2016-12-22 01:21:57
last_update2016-12-22 01:21:57
depth1
children0
last_payout2017-01-21 22:05:57
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length765
author_reputation46,276,338,038,330
root_title"Let‘s develop a Steemit API Wrapper for Java"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id2,060,112
net_rshares47,555,649,862
author_curate_reward""
vote details (1)