I'm using the iTunes search API (more specifically this gem for rails) for an app where the most important part of the query is the genre. I have a checklist where the user can select a certain genre and the matching genreId will be searched for in the query. However, I cannot figure out what to put in the term field that will apply to all results returned, and I cannot omit that attribute because it is required. If I put in the name of the genre, like "Technology", then only podcasts with the word "technology" in the title or artist name are returned, which is not ideal.
ITunesSearchAPI.search(:term=> "????", :genreId=> @genre_id , :country => "US", :entity=> "podcast", :media => "podcast", :limit => 15)
I've tried "+" since "URL encoding replaces spaces with the plus (+) character" according to the iTunes search API documentation. I've also tried "podcast", which produces the same issue as above. Is there any way to get around this issue?
You can't bypass
termbecause it's required parameter.To make url-encoded string you need to use
URI::encode('string')method.Like this: