- Previous: Method: Track Charts
- Up: Introduction
- Next:
Method: Track Search
Conducts a track (song) search using a search term and provides paginated results.
Request URL
The object is track and the action is search. The base request URL is:
http://api.emusic.com/track/search?apiKey=myKey&term=search+term
Request Parameters
Following is a list of required and optional query string parameters for the Track Search method. For more information about individual request parameters, see request parameters.
| Name | Required | Default | Description |
| apiKey | YES | none | The developer API key. This is required for all methods. |
| term | depends | none | A URL-encoded search term with which to search tracks. One of term, albumId, artistId, genreId, labelId or styleId must be provided. |
| albumId artistId genreId labelId styleId |
depends | none | A related search ID. One of term, albumId, artistId, genreId, labelId or styleId must be provided. |
| page | no | 1 | The starting page index of returned tracks. (Used for paginating through longer result lists.) |
| perPage | no | 20 | The number of tracks to return per page. |
| format | no | XML | The format of the response (XML, JSON, JSONP). |
| callback | depends | none | The name of the JavaScript callback method for the JSONP format. (Required for JSONP responses only.) |
| imageSize | no | medium | The size of the album images referred to by image URLs (thumbnail, small, medium, large, huge). |
| fref | no | none | The eMusic partner tag. If provided, the FREF value is automatically added to all appropriate eMusic links. |
Example Requests
// Returns the first 20 tracks that contain the string "jamaica".
http://api.emusic.com/track/search?apiKey=myKey&term=jamaica
// Returns the third page of 10 tracks.
http://api.emusic.com/track/search?apiKey=myKey&term=jamaica&page=3&perPage=10
// Returns the first 20 tracks with artist ID 11002212.
http://api.emusic.com/track/search?apiKey=myKey&artistId=11002212
// Returns the first 20 tracks in JSON using large images.
http://api.emusic.com/track/search?apiKey=myKey&term=jamaica&
format=JSON&imageSize=large
// Returns the third page of 10 albums in JSONP using a callback of
// someMethod() and an FREF value of 400060.
http://api.emusic.com/track/search?apiKey=myKey&term=love+songs&page=3&perPage=10&
format=JSONP&callback=someMethod&fref=400060
Response Format
Following is a list of returned elements for the Track Search method. For more information about individual response elements, see Response Elements.
| Name | Type | Returned | Description |
| status | status | always | Contains a result code. |
| messages | list | on error | Contains one or more messages. |
| options | options | on ok | Contains a list of method options. |
| search | search | on ok | Contains the search term. |
| view | view | on ok | Contains the paginate result counts. |
| tracks | list | on ok | Contains a paged list of tracks that meet the search criteria. See the example response below for typical track elements. |
Example Response
<?xml version="1.0" encoding="UTF-8"?> <response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<status code="200">ok</status>
<options format="xml"/>
<search term="jamaica"/>
<view page="1" pages="128" perPage="3" total="384"/>
<tracks list="true" size="3">
<track id="14891335" length="230" name="Jamaica">
<album id="10994328" image="http://images.emusic.com/music/images/album/0/109/943/10994328/300x300.jpg" name="The Biggest Reggae One-Drop Anthems 2005"url="http://www.emusic.com/album/Various-Artists-The-Biggest-Reggae-One-Drop-Anthems-2005-MP3-Download/10994328.html">
<artist id="10555806" name="Various Artists" url="http://www.emusic.com/artist/Various-Artists-MP3-Download/10555806.html"/>
<label id="138925" name="Greensleeves Records Ltd. / The Orchard" url="http://www.emusic.com/label/MP3-Download/138925.html"/>
<genre id="288" name="International" url="http://www.emusic.com/genre/288.html"/>
</album>
</track>
<track id="15412187" length="391" name="Jamaica">
<album id="11040964" image="http://images.emusic.com/music/images/album/0/110/409/11040964/300x300.jpg" name="Disco Remixed Project Vol. 4" url="http://www.emusic.com/album/Various-Disco-Remixed-Project-Vol-4-MP3-Download/11040964.html">
<artist id="10559248" name="Various" url="http://www.emusic.com/artist/Various-MP3-Download/10559248.html"/>
<label id="143649" name="Essential Media Group / IODA" url="http://www.emusic.com/label/MP3-Download/143649.html"/>
<genre id="281" name="Electronic" url="http://www.emusic.com/genre/281.html"/>
</album>
</track>
<track id="15968339" length="185" name="Jamaica">
<album id="11105729" image="http://images.emusic.com/music/images/album/0/111/057/11105729/300x300.jpg" name="Latin Antigua" url="http://www.emusic.com/album/Tom-Joy-Latin-Antigua-MP3-Download/11105729.html">
<artist id="11688308" name="Tom & Joy" url="http://www.emusic.com/artist/Tom-Joy-MP3-Download/11688308.html"/>
<label id="154149" name="Yellow Productions / Believe Digital" url="http://www.emusic.com/label/MP3-Download/154149.html"/>
<genre id="281" name="Electronic" url="http://www.emusic.com/genre/281.html"/>
</album>
</track>
</tracks>
</response>
- Previous: Method: Track Charts
- Up: Introduction
- Next:
Docs Navigation
- Introduction
- Request Format
- Response Elements
- Result Codes
- Response Format
- Code Samples
- Branding Guidelines
- Method Index
- Request Parameters
- Method: Album Charts
- Method: Album Editorial
- Method: Album Info
- Method: Album Picks
- Method: Album Ratings
- Method: Album Reviews
- Method: Album Search
- Method: Artist Charts
- Method: Artist Editorial
- Method: Artist Info
- Method: Artist Picks
- Method: Artist Ratings
- Method: Artist Related
- Method: Artist Search
- Method: Book Charts
- Method: Book Editorial
- Method: Book Info
- Method: Book Ratings
- Method: Book Reviews
- Method: Book Search
- Method: Label Info
- Method: Label Search
- Method: Track Charts
- Method: Track Search
0 Comments
Please sign in to post a comment.