Skip to content

appliedtechnology/saltJokesAPI

 
 

Repository files navigation

SaltJokesAPI

codecov

this all needs an update

See the deployed API here!

Background

In order for new developers to learn how to use various API's, we've previously worked with various open API's that are open for public use. Due to changes in other API's, or by the people represented acting up, we created a new API service that just returns simple jokes.

Stack

Kotlin Spring PostgreSQL GCP

How to use (public)

Simply call the endpoint {where ever it's running}/api/jokes/random with a GET, and you'll get a random joke.

  • /api/jokes will return all jokes
  • /api/jokes/{id} will return the joke with that ID.

You can also use the language param on /api/jokes/random and /api/jokes, and it will filter the jokes by language.

example: /api/jokes/random?language=se will return a random joke in Swedish!

How to use (admin)

In order to perform any operations except from GETting jokes. You'll need to authenticate yourself. Do this by adding basic authentication in the API tool you're using. Reach out to me if you're not aware of the admin details. You can do it either a API tool like Postman, or by using the console in your browser.

Adding a joke

In order to add a joke to the Database, issue a POST request to /api/jokes with a Joke in the body, with the following format:

{
  "text" : "{funny joke}",
  "language" : "en"
}

This will create a new joke and assign a new random UUID, you'll get the id in a response 201 location header.

Deleting a joke

In order to delete a joke, simply make a DELETE request to api/jokes/{id}.

Updating a joke

In order to update a Joke, send a PUT request to api/jokes/{id} with the updated version of the joke in the body (like te POST request) and the joke will be updated. Note that "language" has to be present.

Roadmap

Swagger is not applicable since there's no current version that supports this application. Upcoming is a UI to actually interact with the backend for administration.

Releases

No releases published

Packages

No packages published

Languages

  • Kotlin 99.4%
  • Dockerfile 0.6%