Spotify API Java is a Java-based client for interacting with the Spotify Web API. The project provides a clean, extensible request–builder architecture for performing authenticated Spotify operations such as search. It is designed for educational and practical use, focusing on maintainable code structure, correct request construction, and ease of integration into backend
- Retrieve Spotify information:
- Tracks
- Albums
- Artists
- Podcast Shows
- Podcast Episodes
- OAuth-based authentication (Application + Client tokens)
- Search using Spotify API
- Pagination support through a generic
Paging<T>model - Hibernate ORM integration
- Automatic Docker startup via Maven plugin (for PostgreSQL)
- Java 24
- Gson
- Hibernate ORM
- PostgreSQL
- Jersey (JAX-RS)
- JUnit 4/5 & TestNG
- Maven
- Docker Compose (optional for PostgreSQL)
- Spotify Web API
- Java 24
- Maven 3+
- Docker
- Docker Compose
- An active internet connection (Spotify API access)
- Credentials to authenticate with Spotify
Clone the repository from GitHub:
git clone https://github.com/MKorolyova/Spotify-API-Java.git
cd Spotify-API-JavaConfigure your Spotify credentials.
Inside the project, create an env package under src/main/java/org/example/jamyaps/:
mkdir src/main/java/org/example/jamyaps/envCreate a class named httpConnection.java inside this package:
touch src/main/java/org/example/jamyaps/env/httpConnection.javaAdd the following fields to the class:
public class httpConnection {
public static final String TOKEN_URL = "https://accounts.spotify.com/api/token";
public static final String BASE_URL = "https://api.spotify.com/v1";
public static final String CLIENT_ID = "YOUR_CLIENT_ID";
public static final String CLIENT_SECRET = "YOUR_CLIENT_SECRET";
}Run the JavaFX application using Maven (Docker daemon must run before execution of this command):
mvn javafx:run