What is the country parameter for USA?

  • 0
  • 1
  • Question
  • Updated 2 years ago
  • Answered
So I'm trying to use the geo.getTopTracks API method to access the top tracks in the US, but I can't seem to figure out the correct value to enter into the country parameter.  I've tried almost everything I can think of including: "u_s_a", "united_states_of_america", "u-s-a", "united-states-of-america", and almost any combination of those with underscores, hyphens, etc and none of them seem to work.  Does anyone know what the correct value to enter is? 
Photo of Louis Quicksell

Louis Quicksell

  • 2 Posts
  • 1 Reply Like
  • frustrated

Posted 2 years ago

  • 0
  • 1
Photo of Hans-Jürgen

Hans-Jürgen, Moderator

  • 2172 Posts
  • 1130 Reply Likes
country (Required) : A country name, as defined by the ISO 3166-1 country names standard
https://en.wikipedia.org/wiki/ISO_3166-1

And the answer is: "What is the United States of America?" - US"
(Edited)
Photo of Simon P

Simon P

  • 20 Posts
  • 21 Reply Likes
"United States" works
Photo of Louis Quicksell

Louis Quicksell

  • 2 Posts
  • 1 Reply Like
So I tried both "US" and "United States", but neither of them work. 

If a country name has spaces, do you need to put the parameter in quotations?  Like this:
'http://ws.audioscrobbler.com/2.0/?method=geo.gettoptracks&country="United States of America"&api_key='

Or no quotations and underscores instead of spaces? Like this:
'http://ws.audioscrobbler.com/2.0/?method=geo.gettoptracks&country="United_States_of_America"&api_key='

As a reference, when I would like to get the top tracks in Paris, France this call works:
'http://ws.audioscrobbler.com/2.0/?method=geo.gettoptracks&country=france&location=paris&...'

Also, is there a list of cities that Last.fm has top track data for?  I was hoping to map top track data for major cities across the world, but I'd like to know which ones are available to be referenced using the API.
Photo of snyde1

snyde1

  • 109 Posts
  • 72 Reply Likes
united%20states