Accessing Spotify API for Multiple Artists in R
<p>I have created a Client ID and Secret Key in Spotify's developer app section. I am referencing this document and want to extend this by choosing multiple artists. </p>

<p><a href="https://www.r-bloggers.com/the-eurovision-2016-song-contest-in-an-r-shiny-app/" rel="nofollow">https://www.r-bloggers.com/the-eurovision-2016-song-contest-in-an-r-shiny-app/</a> </p>

<p>In this example, they are only choosing 1 artist ID but there are some holes to this,</p>

<p>1) How do you obtain the artist name rather than the artist ID because I can't find a glossary key anywhere for the artist ID?</p>

<p>2) How do you choose multiple artists rather than just one. </p>

<p>So for example, how do I choose Frank Sinatra and Elvis Presley?</p>

<p>Code is below: </p>

<pre><code>library(httr)

clientID = '#############################'
secret = '########################'

response = POST(
  'https://accounts.spotify.com/api/token',
  accept_json(),
  authenticate(clientID, secret),
  body = list(grant_type = 'client_credentials'),
  encode = 'form',
  verbose()
)

mytoken = content(response)$access_token
## Frank Sinatra spotify artist ID
artistID = '1Mxqyy3pSjf8kZZL4QVxS0'

HeaderValue = paste0('Bearer ', mytoken)

URI = paste0('https://api.spotify.com/v1/artists/', artistID)
response2 = GET(url = URI, add_headers(Authorization = HeaderValue))
Artist = content(response2)
Artist
</code></pre>

<p>My goal here is to get all of the attributes about each of the artists songs such as danceability, etc. </p>

<p>Any help would be great, thanks!</p>