Skip to content

sclark-org/spotify-openapi-php-server

Repository files navigation

OpenAPIServer

You can use Spotify's Web API to discover music and podcasts, manage your Spotify library, control audio playback, and much more. Browse our available Web API endpoints using the sidebar at left, or via the navigation bar on top of this page on smaller screens.

In order to make successful Web API requests your app will need a valid access token. One can be obtained through <a href="https://developer.spotify.com/documentation/general/guides/authorization-guide/\">OAuth 2.0.

The base URI for all Web API requests is https://api.spotify.com/v1.

Need help? See our <a href="https://developer.spotify.com/documentation/web-api/guides/\">Web API guides for more information, or visit the <a href="https://community.spotify.com/t5/Spotify-for-Developers/bd-p/Spotify_Developer\">Spotify for Developers community forum to ask questions and connect with other developers.

This Symfony bundle is automatically generated by the OpenAPI Generator project:

  • API version: 1.0.0
  • Generator version: 7.14.0-SNAPSHOT
  • Build package: org.openapitools.codegen.languages.PhpSymfonyServerCodegen

Requirements

PHP 8.0 and later

Installation & Usage

To install the dependencies via Composer, add the following repository to composer.json of your Symfony project:

{
    "repositories": [{
        "type": "path",
        "url": "//Path to your generated openapi bundle"
    }],
}

Then run:

composer require GIT_USER_ID/GIT_REPO_ID:dev-master

to add the generated openapi bundle as a dependency.

Tests

To run the unit tests for the generated bundle, first navigate to the directory containing the code, then run the following commands:

composer install
./vendor/bin/phpunit

Getting Started

Step 1: Please follow the installation procedure first.

Step 2: Enable the bundle in the bundle configuration:

// app/config/bundles.php
return [
    // ...
    OpenAPI\Server\OpenAPIServerBundle::class => ['all' => true],
];

Step 3: Register the routes:

# app/config/routes.yaml
open_api_server:
    resource: "@OpenAPIServerBundle/Resources/config/routing.yaml"

Step 4: Implement the API calls:

<?php
// src/Acme/MyBundle/Api/AlbumsApi.php

namespace Acme\MyBundle\Api;

use OpenAPI\Server\Api\AlbumsApiInterface;

class AlbumsApi implements AlbumsApiInterface // An interface is autogenerated
{

    /**
     * Configure OAuth2 access token for authorization: oauth_2_0
     */
    public function setoauth_2_0($oauthToken)
    {
        // Retrieve logged in user from $oauthToken ...
    }
    
    /**
     * Implementation of AlbumsApiInterface#checkUsersSavedAlbums
     */
    public function checkUsersSavedAlbums(string $ids, int &$responseCode, array &$responseHeaders): array|object|null
    {
        // Implement the operation ...
    }

    // Other operation methods ...
}

Step 5: Tag your API implementation:

# config/services.yaml
services:
    # ...
    Acme\MyBundle\Api\AlbumsApi:
        tags:
            - { name: "open_api_server.api", api: "albums" }
    # ...

Now you can start using the bundle!

Documentation for API Endpoints

All URIs are relative to https://api.spotify.com/v1

Class Method HTTP request Description
AlbumsApiInterface checkUsersSavedAlbums GET /me/albums/contains Check User's Saved Albums
AlbumsApiInterface getAnAlbum GET /albums/{id} Get Album
AlbumsApiInterface getAnAlbumsTracks GET /albums/{id}/tracks Get Album Tracks
AlbumsApiInterface getAnArtistsAlbums GET /artists/{id}/albums Get Artist's Albums
AlbumsApiInterface getMultipleAlbums GET /albums Get Several Albums
AlbumsApiInterface getNewReleases GET /browse/new-releases Get New Releases
AlbumsApiInterface getUsersSavedAlbums GET /me/albums Get User's Saved Albums
AlbumsApiInterface removeAlbumsUser DELETE /me/albums Remove Users' Saved Albums
AlbumsApiInterface saveAlbumsUser PUT /me/albums Save Albums for Current User
ArtistsApiInterface checkCurrentUserFollows GET /me/following/contains Check If User Follows Artists or Users
ArtistsApiInterface followArtistsUsers PUT /me/following Follow Artists or Users
ArtistsApiInterface getAnArtist GET /artists/{id} Get Artist
ArtistsApiInterface getAnArtistsAlbums GET /artists/{id}/albums Get Artist's Albums
ArtistsApiInterface getAnArtistsRelatedArtists GET /artists/{id}/related-artists Get Artist's Related Artists
ArtistsApiInterface getAnArtistsTopTracks GET /artists/{id}/top-tracks Get Artist's Top Tracks
ArtistsApiInterface getFollowed GET /me/following Get Followed Artists
ArtistsApiInterface getMultipleArtists GET /artists Get Several Artists
ArtistsApiInterface unfollowArtistsUsers DELETE /me/following Unfollow Artists or Users
AudiobooksApiInterface checkUsersSavedAudiobooks GET /me/audiobooks/contains Check User's Saved Audiobooks
AudiobooksApiInterface getAnAudiobook GET /audiobooks/{id} Get an Audiobook
AudiobooksApiInterface getAudiobookChapters GET /audiobooks/{id}/chapters Get Audiobook Chapters
AudiobooksApiInterface getMultipleAudiobooks GET /audiobooks Get Several Audiobooks
AudiobooksApiInterface getUsersSavedAudiobooks GET /me/audiobooks Get User's Saved Audiobooks
AudiobooksApiInterface removeAudiobooksUser DELETE /me/audiobooks Remove User's Saved Audiobooks
AudiobooksApiInterface saveAudiobooksUser PUT /me/audiobooks Save Audiobooks for Current User
CategoriesApiInterface getACategoriesPlaylists GET /browse/categories/{category_id}/playlists Get Category's Playlists
CategoriesApiInterface getACategory GET /browse/categories/{category_id} Get Single Browse Category
CategoriesApiInterface getCategories GET /browse/categories Get Several Browse Categories
ChaptersApiInterface getAChapter GET /chapters/{id} Get a Chapter
ChaptersApiInterface getAudiobookChapters GET /audiobooks/{id}/chapters Get Audiobook Chapters
ChaptersApiInterface getSeveralChapters GET /chapters Get Several Chapters
EpisodesApiInterface checkUsersSavedEpisodes GET /me/episodes/contains Check User's Saved Episodes
EpisodesApiInterface getAShowsEpisodes GET /shows/{id}/episodes Get Show Episodes
EpisodesApiInterface getAnEpisode GET /episodes/{id} Get Episode
EpisodesApiInterface getMultipleEpisodes GET /episodes Get Several Episodes
EpisodesApiInterface getUsersSavedEpisodes GET /me/episodes Get User's Saved Episodes
EpisodesApiInterface removeEpisodesUser DELETE /me/episodes Remove User's Saved Episodes
EpisodesApiInterface saveEpisodesUser PUT /me/episodes Save Episodes for Current User
GenresApiInterface getRecommendationGenres GET /recommendations/available-genre-seeds Get Available Genre Seeds
LibraryApiInterface changePlaylistDetails PUT /playlists/{playlist_id} Change Playlist Details
LibraryApiInterface checkCurrentUserFollows GET /me/following/contains Check If User Follows Artists or Users
LibraryApiInterface checkUsersSavedAlbums GET /me/albums/contains Check User's Saved Albums
LibraryApiInterface checkUsersSavedAudiobooks GET /me/audiobooks/contains Check User's Saved Audiobooks
LibraryApiInterface checkUsersSavedEpisodes GET /me/episodes/contains Check User's Saved Episodes
LibraryApiInterface checkUsersSavedShows GET /me/shows/contains Check User's Saved Shows
LibraryApiInterface checkUsersSavedTracks GET /me/tracks/contains Check User's Saved Tracks
LibraryApiInterface createPlaylist POST /users/{user_id}/playlists Create Playlist
LibraryApiInterface followArtistsUsers PUT /me/following Follow Artists or Users
LibraryApiInterface getAListOfCurrentUsersPlaylists GET /me/playlists Get Current User's Playlists
LibraryApiInterface getFollowed GET /me/following Get Followed Artists
LibraryApiInterface getUsersSavedAlbums GET /me/albums Get User's Saved Albums
LibraryApiInterface getUsersSavedAudiobooks GET /me/audiobooks Get User's Saved Audiobooks
LibraryApiInterface getUsersSavedEpisodes GET /me/episodes Get User's Saved Episodes
LibraryApiInterface getUsersSavedShows GET /me/shows Get User's Saved Shows
LibraryApiInterface getUsersSavedTracks GET /me/tracks Get User's Saved Tracks
LibraryApiInterface getUsersTopArtistsAndTracks GET /me/top/{type} Get User's Top Items
LibraryApiInterface removeAlbumsUser DELETE /me/albums Remove Users' Saved Albums
LibraryApiInterface removeAudiobooksUser DELETE /me/audiobooks Remove User's Saved Audiobooks
LibraryApiInterface removeEpisodesUser DELETE /me/episodes Remove User's Saved Episodes
LibraryApiInterface removeShowsUser DELETE /me/shows Remove User's Saved Shows
LibraryApiInterface removeTracksUser DELETE /me/tracks Remove User's Saved Tracks
LibraryApiInterface saveAlbumsUser PUT /me/albums Save Albums for Current User
LibraryApiInterface saveAudiobooksUser PUT /me/audiobooks Save Audiobooks for Current User
LibraryApiInterface saveEpisodesUser PUT /me/episodes Save Episodes for Current User
LibraryApiInterface saveShowsUser PUT /me/shows Save Shows for Current User
LibraryApiInterface saveTracksUser PUT /me/tracks Save Tracks for Current User
LibraryApiInterface unfollowArtistsUsers DELETE /me/following Unfollow Artists or Users
MarketsApiInterface getAvailableMarkets GET /markets Get Available Markets
PlayerApiInterface addToQueue POST /me/player/queue Add Item to Playback Queue
PlayerApiInterface getAUsersAvailableDevices GET /me/player/devices Get Available Devices
PlayerApiInterface getInformationAboutTheUsersCurrentPlayback GET /me/player Get Playback State
PlayerApiInterface getQueue GET /me/player/queue Get the User's Queue
PlayerApiInterface getRecentlyPlayed GET /me/player/recently-played Get Recently Played Tracks
PlayerApiInterface getTheUsersCurrentlyPlayingTrack GET /me/player/currently-playing Get Currently Playing Track
PlayerApiInterface pauseAUsersPlayback PUT /me/player/pause Pause Playback
PlayerApiInterface seekToPositionInCurrentlyPlayingTrack PUT /me/player/seek Seek To Position
PlayerApiInterface setRepeatModeOnUsersPlayback PUT /me/player/repeat Set Repeat Mode
PlayerApiInterface setVolumeForUsersPlayback PUT /me/player/volume Set Playback Volume
PlayerApiInterface skipUsersPlaybackToNextTrack POST /me/player/next Skip To Next
PlayerApiInterface skipUsersPlaybackToPreviousTrack POST /me/player/previous Skip To Previous
PlayerApiInterface startAUsersPlayback PUT /me/player/play Start/Resume Playback
PlayerApiInterface toggleShuffleForUsersPlayback PUT /me/player/shuffle Toggle Playback Shuffle
PlayerApiInterface transferAUsersPlayback PUT /me/player Transfer Playback
PlaylistsApiInterface addTracksToPlaylist POST /playlists/{playlist_id}/tracks Add Items to Playlist
PlaylistsApiInterface changePlaylistDetails PUT /playlists/{playlist_id} Change Playlist Details
PlaylistsApiInterface checkIfUserFollowsPlaylist GET /playlists/{playlist_id}/followers/contains Check if Users Follow Playlist
PlaylistsApiInterface createPlaylist POST /users/{user_id}/playlists Create Playlist
PlaylistsApiInterface followPlaylist PUT /playlists/{playlist_id}/followers Follow Playlist
PlaylistsApiInterface getACategoriesPlaylists GET /browse/categories/{category_id}/playlists Get Category's Playlists
PlaylistsApiInterface getAListOfCurrentUsersPlaylists GET /me/playlists Get Current User's Playlists
PlaylistsApiInterface getFeaturedPlaylists GET /browse/featured-playlists Get Featured Playlists
PlaylistsApiInterface getListUsersPlaylists GET /users/{user_id}/playlists Get User's Playlists
PlaylistsApiInterface getPlaylist GET /playlists/{playlist_id} Get Playlist
PlaylistsApiInterface getPlaylistCover GET /playlists/{playlist_id}/images Get Playlist Cover Image
PlaylistsApiInterface getPlaylistsTracks GET /playlists/{playlist_id}/tracks Get Playlist Items
PlaylistsApiInterface removeTracksPlaylist DELETE /playlists/{playlist_id}/tracks Remove Playlist Items
PlaylistsApiInterface reorderOrReplacePlaylistsTracks PUT /playlists/{playlist_id}/tracks Update Playlist Items
PlaylistsApiInterface unfollowPlaylist DELETE /playlists/{playlist_id}/followers Unfollow Playlist
PlaylistsApiInterface uploadCustomPlaylistCover PUT /playlists/{playlist_id}/images Add Custom Playlist Cover Image
SearchApiInterface search GET /search Search for Item
ShowsApiInterface checkUsersSavedShows GET /me/shows/contains Check User's Saved Shows
ShowsApiInterface getAShow GET /shows/{id} Get Show
ShowsApiInterface getAShowsEpisodes GET /shows/{id}/episodes Get Show Episodes
ShowsApiInterface getMultipleShows GET /shows Get Several Shows
ShowsApiInterface getUsersSavedShows GET /me/shows Get User's Saved Shows
ShowsApiInterface removeShowsUser DELETE /me/shows Remove User's Saved Shows
ShowsApiInterface saveShowsUser PUT /me/shows Save Shows for Current User
TracksApiInterface addTracksToPlaylist POST /playlists/{playlist_id}/tracks Add Items to Playlist
TracksApiInterface checkUsersSavedTracks GET /me/tracks/contains Check User's Saved Tracks
TracksApiInterface getAnAlbumsTracks GET /albums/{id}/tracks Get Album Tracks
TracksApiInterface getAnArtistsTopTracks GET /artists/{id}/top-tracks Get Artist's Top Tracks
TracksApiInterface getAudioAnalysis GET /audio-analysis/{id} Get Track's Audio Analysis
TracksApiInterface getAudioFeatures GET /audio-features/{id} Get Track's Audio Features
TracksApiInterface getPlaylistsTracks GET /playlists/{playlist_id}/tracks Get Playlist Items
TracksApiInterface getRecommendations GET /recommendations Get Recommendations
TracksApiInterface getSeveralAudioFeatures GET /audio-features Get Tracks' Audio Features
TracksApiInterface getSeveralTracks GET /tracks Get Several Tracks
TracksApiInterface getTrack GET /tracks/{id} Get Track
TracksApiInterface getUsersSavedTracks GET /me/tracks Get User's Saved Tracks
TracksApiInterface getUsersTopArtistsAndTracks GET /me/top/{type} Get User's Top Items
TracksApiInterface removeTracksPlaylist DELETE /playlists/{playlist_id}/tracks Remove Playlist Items
TracksApiInterface removeTracksUser DELETE /me/tracks Remove User's Saved Tracks
TracksApiInterface reorderOrReplacePlaylistsTracks PUT /playlists/{playlist_id}/tracks Update Playlist Items
TracksApiInterface saveTracksUser PUT /me/tracks Save Tracks for Current User
UsersApiInterface checkCurrentUserFollows GET /me/following/contains Check If User Follows Artists or Users
UsersApiInterface checkIfUserFollowsPlaylist GET /playlists/{playlist_id}/followers/contains Check if Users Follow Playlist
UsersApiInterface followArtistsUsers PUT /me/following Follow Artists or Users
UsersApiInterface followPlaylist PUT /playlists/{playlist_id}/followers Follow Playlist
UsersApiInterface getCurrentUsersProfile GET /me Get Current User's Profile
UsersApiInterface getFollowed GET /me/following Get Followed Artists
UsersApiInterface getListUsersPlaylists GET /users/{user_id}/playlists Get User's Playlists
UsersApiInterface getUsersProfile GET /users/{user_id} Get User's Profile
UsersApiInterface getUsersTopArtistsAndTracks GET /me/top/{type} Get User's Top Items
UsersApiInterface unfollowArtistsUsers DELETE /me/following Unfollow Artists or Users
UsersApiInterface unfollowPlaylist DELETE /playlists/{playlist_id}/followers Unfollow Playlist

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

oauth_2_0

  • Type: OAuth
  • Flow: accessCode
  • Authorization URL: https://accounts.spotify.com/authorize
  • Scopes:
  • app-remote-control: Communicate with the Spotify app on your device.
  • playlist-modify-private: Manage your private playlists.
  • playlist-modify-public: Manage your public playlists.
  • playlist-read-collaborative: Access your collaborative playlists.
  • playlist-read-private: Access your private playlists.
  • streaming: Play content and control playback on your other devices.
  • ugc-image-upload: Upload images to Spotify on your behalf.
  • user-follow-modify: Manage your saved content.
  • user-follow-read: Access your followers and who you are following.
  • user-library-modify: Manage your saved content.
  • user-library-read: Access your saved content.
  • user-modify-playback-state: Control playback on your Spotify clients and Spotify Connect devices.
  • user-read-currently-playing: Read your currently playing content.
  • user-read-email: Get your real email address.
  • user-read-playback-position: Read your position in content you have played.
  • user-read-playback-state: Read your currently playing content and Spotify Connect devices information.
  • user-read-private: Access your subscription details.
  • user-read-recently-played: Access your recently played items.
  • user-top-read: Read your top artists and content.

Author

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors