The purpose of this document is to provide listing and short documentation of API methods implemented in raw4j
There are some assumptions taken here.
1) You must be aware that currently all Exceptions are thrown up to the RedditException, therefore your code should be defensive like so:
try {
//for example purposes, but it could be any of the calls
//assume a response POJO if you want
RedditJsonMessage response = reddit.login( "username", "password" );
} catch( RedditException re ) {
//RedditException merely inherits Exception.
re.printStackTrace();
}
2) Reddit currently keeps state and requires you to .login() before doing certain methods requiring validated reddit_cookie, modhash, etc.
RedditAccount account = reddit.login( "username", "password" );
RedditAccount account = reddit.meJson( "username", "password" );
- POST /api/clear_sessions
- POST /api/delete_user
- POST /api/register
- POST /api/update
- GET /v1/me
- POST /api/adddeveloper
- POST /api/deleteapp
- POST /api/removedeveloper
- POST /api/revokeapp
- POST /api/setappicon
- POST /api/updateapp
RedditJsonMessage captchaMessage = reddit.newCaptcha();
String iden = captchaMessage.getIden();
- GET /api/needs_captcha.json
- GET captcha/iden
- POST /api/clearflairtemplates
- POST /api/deleteflair
- POST /api/deleteflairtemplate
- POST /api/flair
- POST /api/flairconfig
- POST /api/flaircsv
- GET /api/flairlist
- POST /api/flairtemplate
- POST /api/selectflair
- POST /api/setflairenabled
RedditJsonMessage responseMessage = reddit.comment( "the comment raw markdown stuff", "fullname_of_parent");
//Works for Comments and Links as far as I know
reddit.delete( "fullname of thing to delete" );
//We assume that you have retrieved some sort of data about the comment you wish to get morechildren for.
RedditComments theComments = reddit.commentsFor( "some-subreddit", "link-id" );
List<RedditComment> moreComments = testReddit.moreChildrenFor( theComments, "sort-order");
reddit.vote("link-id", 1); //Upvote
reddit.vote("link-id", 0); //Remove vote
reddit.vote("link-id", -1); //Downvote
reddit.markNSFW("link-id"); //Mark link "Not Safe for Work"
reddit.unmarkNSFW("link-id"); //Unmark link "Not Safe for Work"
- POST /api/editusertext
- POST /api/hide
- GET /api/info
- POST /api/report
- POST /api/save
- POST /api/unhide
- POST /api/unsave
//They have very similar calls, so we've lumped them all together
List<RedditLink> links = reddit.listingFor( "some-subreddit", "*hot*|*new*|*controversial*|*top*|*random*");
//Assumes you already have the subreddit and thing ID
//Also has special wrapper object
RedditComments theComments = reddit.commentsFor( "some-subreddit", "thing-id");
private messages
List<RedditMessage> inboxMessages = reddit.messages( "inbox");
- GET /message/sent
- GET /message/unread
- GET /message/where
- POST /api/compose
- POST /api/block
- POST /api/read_message
- POST /api/unread_message
#moderation
- POST /api/approve
- POST /api/distinguish
- POST /api/ignore_reports
- POST /api/leavecontributor
- POST /api/leavemoderator
- POST /api/remove
- POST /api/unignore_reports
- GET /moderationlog
- GET /stylesheet
#search
- GET /search
List<RedditSubreddit> subreddits = reddit.subreddits("popular");
- POST /api/accept_moderator_invite
- POST /api/delete_sr_header
- POST /api/delete_sr_img
- POST /api/site_admin
- POST /api/subreddit_stylesheet
- GET /api/subreddits_by_topic.json
- POST /api/subscribe
- POST /api/upload_sr_img
- GET /r/subreddit/about.json
- GET /subreddits/mine/contributor
- GET /subreddits/mine/moderator
- GET /subreddits/mine/subscriber.json
- GET /subreddits/new
- GET /subreddits/search
- GET /subreddits/where
RedditAccount account = reddit.userInfoFor("JavaJerseyTestBot");
- GET /user/username/disliked
- GET /user/username/hidden
- GET /user/username/liked
- GET user/username/submitted
- GET /user/username/comments
- POST /api/friend
- POST /api/setpermissions
- POST /api/unfriend
- GET /api/username_available.json
- GET /user/username/overview
- GET /user/username/saved
- GET /user/username/where
- POST /api/wiki/alloweditor/add
- POST /api/wiki/alloweditor/del
- POST /api/wiki/alloweditor/act
- POST /api/wiki/edit
- POST /api/wiki/hide
- POST /api/wiki/revert