an API that returns random Reddit Submissions written in Java https://redditapi.adb.sh/api/v1/r/programmerhumor/random
Go to file
2021-01-31 21:30:18 +01:00
docker add docker-compose and Dockerfile 2021-01-30 21:35:58 +01:00
src/main/java rename error 2021-01-31 21:30:18 +01:00
.gitattributes init gradle add dependency jreddit 2021-01-18 09:23:51 +01:00
.gitignore init gradle add dependency jreddit 2021-01-18 09:23:51 +01:00
build.gradle add docker-compose and Dockerfile 2021-01-30 21:35:58 +01:00
docker-compose.yml add docker-compose and Dockerfile 2021-01-30 21:35:58 +01:00
Dockerfile add docker-compose and Dockerfile 2021-01-30 21:35:58 +01:00
gradlew debug RedditAPI 2021-01-26 20:43:05 +01:00
gradlew.bat debug RedditAPI 2021-01-26 20:43:05 +01:00
RandomRedditMemesAPI.iml init gradle add dependency jreddit 2021-01-18 09:23:51 +01:00
README.md typo in README 2021-01-31 12:30:21 +00:00
settings.gradle init gradle add dependency jreddit 2021-01-18 09:23:51 +01:00

RandomRedditMemesAPI

an API that returns random Reddit Submissions written in Java

build and run

build project

first make sure you're using Gradle 6.8 and openjdk-jdk8

to build the project just run:

gradle build

run

to execute the .jar archive you built before run:

java -jar ./build/libs/RandomRedditMemesAPI.jar

run inside docker

to execute the .jar file inside docker use docker-compose:

docker-compose -p RandomRedditMemesAPI up -d

build docker image

if you want to build a full docker image run:

docker build .

alternatively you can use ./docker/docker-compose.yml

API

the baseurl for the API is: http://127.0.0.1/api/v1

subreddits

subreddit syntax [baseurl]/r/[subreddit]/[type]

[type] syntax

  • all - returns the first 100 submissions of the subreddits page
  • random - returns one random submission of the first 100
  • [0-99] - returns a specific one
  • if undefined returns random

the response looks like:

{
    "subs":[{
        "score": Integer,
        "nsfw": Boolean,
        "author": String,
        "text": String,
        "time": Integer,
        "title": String,
        "downvotes": Integer,
        "permalink": String,
        "subreddit": String,
        "url": String,
    }],
    "error": Boolean/String,
    "type":String
}