https://github.com/sonallux/spotify-web-api-java
A Java wrapper for Spotify's Web API
https://github.com/sonallux/spotify-web-api-java
api-client java spotify spotify-web-api wrapper
Last synced: 8 months ago
JSON representation
A Java wrapper for Spotify's Web API
- Host: GitHub
- URL: https://github.com/sonallux/spotify-web-api-java
- Owner: sonallux
- License: mit
- Created: 2017-09-05T17:50:08.000Z (over 8 years ago)
- Default Branch: main
- Last Pushed: 2025-04-14T18:09:21.000Z (9 months ago)
- Last Synced: 2025-04-14T19:25:05.579Z (9 months ago)
- Topics: api-client, java, spotify, spotify-web-api, wrapper
- Language: Java
- Homepage:
- Size: 977 KB
- Stars: 8
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# spotify-web-api-java
[](https://github.com/sonallux/spotify-web-api-java/actions?query=workflow%3ABuild)
[](https://central.sonatype.com/artifact/de.sonallux.spotify/spotify-web-api-java)
[](https://github.com/sonallux/spotify-web-api-java/blob/main/LICENSE)
A Java wrapper for Spotify's Web API.
## Installation
This library is available on [Maven Central](https://central.sonatype.com/artifact/de.sonallux.spotify/spotify-web-api-java) and requires at least Java 17.
### With maven
```xml
de.sonallux.spotify
spotify-web-api-java
4.3.1
```
### With gradle
```groovy
compile 'de.sonallux.spotify:spotify-web-api-java:4.3.1'
```
## General usage
```java
var authProvider = new SimpleApiAuthorizationProvider("");
var spotifyApi = SpotifyWebApi.builder().authorization(authProvider).build();
var artist = spotifyApi.getArtistsApi().getArtist("").build().execute();
System.out.println(artist.getName());
```
## Authorization
Spotify's web API supports different [authorization flows](https://developer.spotify.com/documentation/web-api/concepts/authorization). All flows require that your application is registered on the [Spotify Developer Dashboard](https://developer.spotify.com/dashboard). You can find more details on how to register your app [here](https://developer.spotify.com/documentation/web-api/concepts/apps). After successful registration you can use one of the following authorization flows with the `spotify-web-api-java`:
### [Authorization code flow](https://developer.spotify.com/documentation/web-api/tutorials/code-flow)
Code example: [AuthorizationCodeExample.java](spotify-web-api-java/src/test/java/examples/AuthorizationCodeExample.java)
### [Authorization code flow with proof key for code exchange (PKCE)](https://developer.spotify.com/documentation/web-api/tutorials/code-pkce-flow)
Code example: [AuthorizationCodePKCEExample.java](spotify-web-api-java/src/test/java/examples/AuthorizationCodePKCEExample.java)
### [Implicit grant](https://developer.spotify.com/documentation/web-api/tutorials/implicit-flow)
Code example: [ImplicitGrantExample.java](spotify-web-api-java/src/test/java/examples/ImplicitGrantExample.java)
### [Client credentials flow](https://developer.spotify.com/documentation/web-api/tutorials/client-credentials-flow)
Code example: [ClientCredentialsExample.java](spotify-web-api-java/src/test/java/examples/ClientCredentialsExample.java)
## How to release a new version
1. Update the version number with `./mvnw versions:set -DnewVersion="" -DgenerateBackupPoms=false`
2. Update version in `CHANGELOG.md` and `README.md`
3. Commit and push changes to GitHub
4. Wait till CI is green
5. Tag the commit created in step 3 and push it. A GitHub actions workflow will automatically deploy the artifacts to Maven Central.
6. Create a release on GitHub mentioning the changes from `CHANGELOG.md`