2012-05-16 53 views
2

我正在嘗試對SoundCloud API執行一個GET請求,該請求通過搜索詞抽取5個最近的曲目。以下是我的查詢網址:Soundcloud API - 通過created_at訂單結果

'http://api.soundcloud.com/tracks.json?{client_id={}&q={search_term}&limit=5&streamable=true&order=created_at' 

但是,這不會按照created_at的順序返回曲目。我寧願不必爲最近的曲目解析數據。我也試過order=latest

編輯:這裏是我的確切查詢網址(減去客戶端ID)和輸出:

http://api.soundcloud.com/tracks.json?client_id={}&q=the%20fray&limit=5&streamable=true&order=created_at 


[ { kind: 'track', 
id: 16393251, 
created_at: '2011/06/02 13:44:54 +0000', 
user_id: 3050663, 
duration: 40269, 
commentable: true, 
state: 'finished', 
original_content_size: 1337259, 
sharing: 'public', 
tag_list: '', 
permalink: 'the-fray', 
description: '', 
streamable: true, 
downloadable: false, 
genre: '', 
release: '', 
purchase_url: null, 
purchase_title: null, 
label_id: null, 
label_name: '', 
isrc: '', 
video_url: null, 
track_type: '', 
key_signature: '', 
bpm: null, 
title: 'The Fray', 
release_year: null, 
release_month: null, 
release_day: null, 
original_format: 'm4a', 
license: 'all-rights-reserved', 
uri: 'http://api.soundcloud.com/tracks/16393251', 
permalink_url: 'http://soundcloud.com/justasterisms/the-fray', 
artwork_url: null, 
waveform_url: 'http://w1.sndcdn.com/YcZLLwkjn2oz_m.png', 
user: 
{ id: 3050663, 
    kind: 'user', 
    permalink: 'justasterisms', 
    username: 'justasterisms', 
    uri: 'http://api.soundcloud.com/users/3050663', 
    permalink_url: 'http://soundcloud.com/justasterisms', 
    avatar_url: 'http://a1.sndcdn.com/images/default_avatar_large.png?2262bae' }, 
stream_url: 'http://api.soundcloud.com/tracks/16393251/stream', 
playback_count: 1676, 
download_count: 0, 
favoritings_count: 6, 
comment_count: 0, 
attachments_uri: 'http://api.soundcloud.com/tracks/16393251/attachments' }, 
{ kind: 'track', 
id: 45035516, 
created_at: '2012/05/02 04:42:13 +0000', 
user_id: 16225631, 
duration: 175530, 
commentable: true, 
state: 'finished', 
original_content_size: 4213990, 
sharing: 'public', 
tag_list: '', 
permalink: 'fray-fowling', 
description: '', 
streamable: true, 
downloadable: true, 
genre: '', 
release: '', 
purchase_url: null, 
purchase_title: null, 
label_id: null, 
label_name: '', 
isrc: '', 
video_url: null, 
track_type: '', 
key_signature: '', 
bpm: null, 
title: 'Fray Fowling', 
release_year: null, 
release_month: null, 
release_day: null, 
original_format: 'mp3', 
license: 'all-rights-reserved', 
uri: 'http://api.soundcloud.com/tracks/45035516', 
permalink_url: 'http://soundcloud.com/the-talismen/fray-fowling', 
artwork_url: null, 
waveform_url: 'http://w1.sndcdn.com/cw8gJ5nC2QHr_m.png', 
user: 
{ id: 16225631, 
    kind: 'user', 
    permalink: 'the-talismen', 
    username: 'The Talismen', 
    uri: 'http://api.soundcloud.com/users/16225631', 
    permalink_url: 'http://soundcloud.com/the-talismen', 
    avatar_url: 'http://a1.sndcdn.com/images/default_avatar_large.png?2262bae' }, 
stream_url: 'http://api.soundcloud.com/tracks/45035516/stream', 
download_url: 'http://api.soundcloud.com/tracks/45035516/download', 
playback_count: 63, 
download_count: 4, 
favoritings_count: 0, 
comment_count: 0, 
attachments_uri: 'http://api.soundcloud.com/tracks/45035516/attachments' }, 
{ kind: 'track', 
id: 26629456, 
created_at: '2011/10/28 19:23:40 +0000', 
user_id: 8445112, 
duration: 159956, 
commentable: true, 
state: 'finished', 
original_content_size: 4094284, 
sharing: 'public', 
tag_list: '', 
permalink: 'samora-the-fray', 
description: '', 
streamable: true, 
downloadable: false, 
genre: 'Metal', 
release: '', 
purchase_url: null, 
purchase_title: null, 
label_id: null, 
label_name: '', 
isrc: null, 
video_url: null, 
track_type: null, 
key_signature: null, 
bpm: null, 
title: 'Samora - The Fray', 
release_year: null, 
release_month: null, 
release_day: null, 
original_format: 'mp3', 
license: 'all-rights-reserved', 
uri: 'http://api.soundcloud.com/tracks/26629456', 
permalink_url: 'http://soundcloud.com/theundergroundtour/samora-the-fray', 
artwork_url: 'http://i1.sndcdn.com/artworks-000013441907-zfq9uz-large.jpg?2262bae', 
waveform_url: 'http://w1.sndcdn.com/PGZOOd4DRbp4_m.png', 
user: 
{ id: 8445112, 
    kind: 'user', 
    permalink: 'theundergroundtour', 
    username: 'The Underground Tour', 
    uri: 'http://api.soundcloud.com/users/8445112', 
    permalink_url: 'http://soundcloud.com/theundergroundtour', 
    avatar_url: 'http://i1.sndcdn.com/avatars-000007060505-pny4ej-large.jpg?2262bae' }, 
stream_url: 'http://api.soundcloud.com/tracks/26629456/stream', 
playback_count: 811, 
download_count: 0, 
favoritings_count: 4, 
comment_count: 0, 
attachments_uri: 'http://api.soundcloud.com/tracks/26629456/attachments' }, 
{ kind: 'track', 
id: 43622727, 
created_at: '2012/04/19 04:37:43 +0000', 
user_id: 15152175, 
duration: 212011, 
commentable: true, 
state: 'finished', 
original_content_size: 1752217, 
sharing: 'public', 
tag_list: 'soundcloud:source=iphone-record', 
permalink: 'the-fray-heartbeat', 
description: null, 
streamable: true, 
downloadable: true, 
genre: null, 
release: null, 
purchase_url: null, 
purchase_title: null, 
label_id: null, 
label_name: null, 
isrc: null, 
video_url: null, 
track_type: 'recording', 
key_signature: null, 
bpm: null, 
title: 'The Fray -- heartbeat', 
release_year: null, 
release_month: null, 
release_day: null, 
original_format: 'm4a', 
license: 'all-rights-reserved', 
uri: 'http://api.soundcloud.com/tracks/43622727', 
permalink_url: 'http://soundcloud.com/nataliazea/the-fray-heartbeat', 
artwork_url: 'http://i1.sndcdn.com/artworks-000021902063-s1cezf-large.jpg?2262bae', 
waveform_url: 'http://w1.sndcdn.com/2IToTsm3iiCv_m.png', 
user: 
{ id: 15152175, 
    kind: 'user', 
    permalink: 'nataliazea', 
    username: 'nataliazea', 
    uri: 'http://api.soundcloud.com/users/15152175', 
    permalink_url: 'http://soundcloud.com/nataliazea', 
    avatar_url: 'http://i1.sndcdn.com/avatars-000013390559-q9pep5-large.jpg?2262bae' }, 
stream_url: 'http://api.soundcloud.com/tracks/43622727/stream', 
download_url: 'http://api.soundcloud.com/tracks/43622727/download', 
playback_count: 563, 
download_count: 45, 
favoritings_count: 2, 
comment_count: 0, 
created_with: 
{ id: 124, 
    kind: 'app', 
    name: 'SoundCloud iOS', 
    uri: 'http://api.soundcloud.com/apps/124', 
    permalink_url: 'http://soundcloud.com/apps/iphone', 
    external_url: 'http://itunes.com/app/soundcloud' }, 
attachments_uri: 'http://api.soundcloud.com/tracks/43622727/attachments' }, 
{ kind: 'track', 
id: 119301, 
created_at: '2009/01/21 18:50:00 +0000', 
user_id: 62320, 
duration: 158824, 
commentable: true, 
state: 'finished', 
original_content_size: 2546372, 
sharing: 'public', 
tag_list: '', 
permalink: 'the-fray-interview', 
description: '', 
streamable: true, 
downloadable: true, 
genre: '', 
release: '', 
purchase_url: null, 
purchase_title: null, 
label_id: null, 
label_name: '', 
isrc: '', 
video_url: null, 
track_type: '', 
key_signature: '', 
bpm: null, 
title: 'The Fray interview', 
release_year: null, 
release_month: null, 
release_day: null, 
original_format: 'mp3', 
license: 'all-rights-reserved', 
uri: 'http://api.soundcloud.com/tracks/119301', 
permalink_url: 'http://soundcloud.com/mattlissack/the-fray-interview', 
artwork_url: null, 
waveform_url: 'http://w1.sndcdn.com/1Ehu7uCn4vg6_m.png', 
user: 
{ id: 62320, 
    kind: 'user', 
    permalink: 'mattlissack', 
    username: 'mattlissack', 
    uri: 'http://api.soundcloud.com/users/62320', 
    permalink_url: 'http://soundcloud.com/mattlissack', 
    avatar_url: 'http://a1.sndcdn.com/images/default_avatar_large.png?2262bae' }, 
stream_url: 'http://api.soundcloud.com/tracks/119301/stream', 
download_url: 'http://api.soundcloud.com/tracks/119301/download', 
playback_count: 613, 
download_count: 5, 
favoritings_count: 0, 
comment_count: 0, 
attachments_uri: 'http://api.soundcloud.com/tracks/119301/attachments' } ] 

回答

2

從文檔瀏覽:http://developers.soundcloud.com/docs/api/tracks 可以使用 &order=created_at&order=hotness

+0

我在上面的URL查詢中嘗試了這一點,但它不會按照'created_at'的順序返回曲目。但是,它確實在文檔中說過一些過濾器不能在搜索中組合。我想知道這是否是問題。 – mnort9

+0

我添加了我的確切查詢和輸出。 – mnort9

+0

這是正確的。訂單目前不能與搜索參數結合使用。 –