I am new using Amazon's Product Advertising API, and for my first project with it, I am trying to get the ASIN of the MP3 download product of a particular song, based on the artist and title. I will eventually be using these ASINs to populate an Amazon MP3 Clips Widget.
I am using the PHP class from CodeDiesel.com to get started. It works just fine, and I have added the following function:
public function searchMusic($artist, $title) {
$parameters = array("Operation" => "ItemSearch",
"Artist" => $artist,
"Title" => $title,
"SearchIndex" => "Music",
"ResponseGroup" => "Medium");
$xml_response=$this->queryAmazon($parameters);
return $xml_response;
}
Now, the trouble is, I can only seem to get albums this way. For instance, if I put in "Robert Randolph" for the artist, and "Colorblind" for the title, I get Robert Randolph and the Family Band's Colorblind album. If I search for a particular track, such as "Thrill Of It", Amazon can't find anything.
So what I need to do is first figure out how to make a query for track title. Then I need to figure out how to limit my results to just MP3 downloads. How can I do this?
If there is documentation on the topic, can you point me in the right direction? I have been reading through it, but don't see any parameters for what I want.
Thank you for your time.
The documentation is oddly organized, and I have a hard time finding relevant information myself.
To look up mp3s, you have to change your
SearchIndex
parameter to 'MP3Downloads'. Then, instead of using "Artist" and "Track", you have to use "Keywords". Combine the artist and track values into one string for the "Keywords" property value. Also, try "MusicTracks" forSearchIndex
, as you might get different results there as well.This is a snippet from a working system I have that does a similar type of lookup.