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.


SteemJV2Logo


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 wss://steemd.steemit.com. This wiki article shows how to add and use WebSocket Endpoints instead of the HTTP Client.


Attention
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.

https://github.com/marvin-we/steem-java-api-wrapper

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.


If you want to stay up to date or just like the stuff I am doing it would be great if you could upvote and resteem this post =).

Thanks for reading and best regards,
@dez1337


Open Source Contribution posted via Utopian.io

H2
H3
H4
3 columns
2 columns
1 column
28 Comments