SteemJ v0.4.2 is available now ~ Use the Steem API in your Java Project
SteemJ v0.4.2 allows you to use the official https://api.steemit.com
endpoint by adding a HTTP Client.
Previous 0.4.x releases: v0.4.2pr1, v0.4.1, v0.4.0
SteemJ v0.4.2 is available now ~ Use the Steem API in your Java Project
Hello Steemians!
I spend this weekend to add the features which were still missing in v0.4.2pr1 to SteemJ and can now proudly announce that v0.4.2 has been released.
What's new?
HTTP Client
The main feature is the HTTP Client which is now used by default. If you are interested in the details of this feature and the reasons behind this you should check out the previous update.
As stated in the Update your STEEM apps! Big changes coming for 3rd party developers post, using the WebSocket endpoint provided by Steem is deprecated. So if you want to stay with the WebSocket connections make sure that you use a different endpoint than
Source - https://ahrefs.com
If you were unable to connect to a WebSocket endpoint as described in Issue #143 this update will finally allow you to use SteemJ. According to @sanjeevm who faced the problem too, the Http Client is working for him.
Improved Permlink Generation
Another shout out goes to philip-healy, who submitted #144 that cleaned up the code for the permlink generation.
Improved Exception Creation
The last big change is the error handling which has been refactored: When I've started to develop SteemJ I had the vision to provide a detailed object for an error response returned by Steem Node. Sadly, the data
field which provides detailed information about the root cause of the error, is really dynamic and totally depends on the call that has been made. Older SteemJ versions tried to push this data field into a pre-defined structure which often caused errors because the structure did not fit for a lot of cases.
With SteemJ 0.4.2 this problem is gone, because now all error responses are wrapped by the new SteemResponseException
. The new Exception could now be thrown by every api call and has the following three fields:
- The
code
field is an Integer and can be requested using the.getCode()
method. - The
message
field is of type String. You can get its value calling the.getMessage()
method. - The
data
field is now of type JsonNode - This allows you to analyse and parse it on your own.
Full Changelog
- #139 Implement a HTTP Client
- #110 Refactor the communication process
- #34 Improve error handling
- #144 Hyphenated permlinks
- #125 Replace app version during release process
General information
What is SteemJ?
SteemJ is a project that allows you to communicate with a Steem node using Java. So far, the project supports most of the API calls and is also able to broadcast most of the common operation types. Further information can be found on GitHub.
Quick Start Guide
Add SteemJ to your project
SteemJ binaries are pushed into the maven central repository and can be integrated with a bunch of build management tools like Maven. The Wiki provides a lot of examples for the most common build tools. If you do not use a build management tool you can download the binaries as described here.
To add this release to your project paste the following snippet into your 'pom.xml'
<dependency>
<groupId>eu.bittrade.libs</groupId>
<artifactId>steemj-core</artifactId>
<version>0.4.2pr1</version>
</dependency>
Start posting
SteemJConfig myConfig = SteemJConfig.getInstance();
myConfig.setDefaultAccount(new AccountName("YOUR-ACCOUNT"));
List<ImmutablePair<PrivateKeyType, String>> privateKeys = new ArrayList<>();
privateKeys.add(new ImmutablePair<>(PrivateKeyType.POSTING, "YOUR-PRIVATE-POSTING-KEY"));
myConfig.getPrivateKeyStorage().addAccount(myConfig.getDefaultAccount(), privateKeys);
steemJ.createComment(new AccountName("steemj"), new Permlink("testofsteemj040"), "Example comment without no link but with a @user .", new String[] { "test" });
Further information
The sample module of the SteemJ project provides showcases for the most common acitivies and operations users want to perform.
Beside that you can find a lot of snippets and examples in the different Wiki sections.
Contribute
The project became quite big and there is still a lot to do. If you want to support the project simply clone the git repository and submit a pull request. I would really appreciate it =).
git clone https://github.com/marvin-we/steem-java-api-wrapper.git
Get in touch!
Most of my projects are pretty time consuming and I always try to provide some useful stuff to the community. What keeps me going for that is your feedback and your support. For that reason I would love to get some Feedback from you <3. Just contact me here on Steemit or ping me on GitHub.
Thanks for reading and best regards,
@dez1337
Open Source Contribution posted via Utopian.io
Nice job!!
Thanks for your feedback and the support since day 1 <3
I've been supporting your work for quite sometime but it's nice to have some confirmation from a friend and good coder like Inertia as I'm not a coder myself. If this help Inertia then it help me and Steem as a whole.
Good job @dez1337!
Hay @teamsteem and thank you too - Yeah, there are a lot of people supporting this project and I am really thankful to each of you guys :)
I am a bot created by @sanjeevm using steemj created by @dez1337 and manually operated by a human.
Well done @sanjeevm and thank you once again for using SteemJ for your project :)
Thank you a lot for such a nice library, there was nothing on Java prior to this.
We will use this bot for charitable purpose. And we will find some people who would contribute to advertise.
Let me know whenever I can help you!
It lives!
https://steemit.com/@newsrx
Well done 💪 and thank you once again for your activities at github 👌
This is great, I think I've been waiting for this
Thanks a lot for your support =)
Just ping me on steemit.chat if you face a problem with the new implementation. :)
Definitely I will.
Good Job!
Question: is it possible to create an article with a picture that is not an url ? (so that it upload the image and create the post).
Hay @tyvain,
Actually I needed something like this some time ago for a project and was searching for a solution.
Hope that helps a bit :)
yeah thanks.
I ended up with the same solution: using cloudinary.com wich is very simple img hosting.
A steemimages lib could be perfect, but 3rd party solutions works well also.
Great to hear that :)
True. I will try to check it again when I have more time, but as you said: Thirdparty libs are working too, so this idea has a quite low priority for me right now :)
The steemit condenser script unfortunately does not leave the src='data:' urls intact, it prefixes them with the steemit images redirect and then the images show up as broken.
I definitely see a use case where simple (well compressed) graphics would be useful to include inline, like for, basic subject oriented icons, bullets, or other simple graphical style-ups for a post.
I see where a user has posted an issue on github in regards to this, maybe enough up-votes on the issue will have positive results?
I also a little surprised that the user posts aren't in a secure iframe? Wouldn't that let them be more permissive as to allowed tags? I notice that even <span> tags are problematic, as well as the lack of inline styles of any kind (it seems a subset could be put into a whitelist of some sort).
https://github.com/steemit/condenser/issues/1888
Thanks for this useful guide.
Hey @dez1337 I am @utopian-io. I have just super-voted you at 47% Power!
Suggestions https://utopian.io/rules
-Utopian has detected 2 bot votes. I am the only bot you should love!!
Achievements
-I am a bot...I love developers... <3
-Good amount of information. Thank you!
-A very informative contribution. Good job!
-Votes on this contribution are going well. Nice!
-You are having more votes than average for this category. Nice!
Up-vote this comment to grow my power and help Open Source contributions like this one.
Excellent! Very attractive for developers. I still have one question though. Is this API meant to create new Steem-based blockchains or is the SteemJ API an interface to the original Steem blockchain?
Hay ho again @chris2jh - SteemJ is a wrapper of the Steem blockchain. It allows you to get user information or to post, vote, transfer, .. :)
Thans again!
For other users interested, go to this post, where I got a very useful explanation from @dez1337
Thanks for your wonderful hard work!
Thanks for the feedback :)
Thank you for the contribution. It has been approved.
You can contact us on Discord.
[utopian-moderator]
Thanks @espoem :)