Public/Get-MultipleAlbums.ps1
function Get-MultipleAlbums { param( # The array of album Ids [Parameter(Mandatory)] [array] $AlbumArray ) $ConstructedAlbumIds = "" # Construct Id string $Count = $AlbumArray.Count foreach ($AlbumId in $AlbumArray) { if ($Count -gt 1) { $ConstructedAlbumIds += "$AlbumId%2C" } else { $ConstructedAlbumIds += $AlbumId } $Count-- } $Query = "?ids=" + $ConstructedAlbumIds $Method = "Get" $Uri = "https://api.spotify.com/v1/albums" + "?" + $Query $Response = Send-SpotifyCall -Method $Method -Uri $Uri return $Response } |