2014-12-28 52 views
0

我添加了一個購買鏈接到我的一個曲目,然後嘗試通過API(Ruby包裝)訪問它。它始終顯示空白字段。如何從API獲取purchase_url

更新purchase_url也不起作用,而其他字段得到更新。

這是一個錯誤或在我身邊做錯了什麼?

+0

你有沒有看到我的答案嗎?如果我幫助你,請將其標記爲已接受。 – JAL

回答

0

你能發佈你的網址嗎?我可以通過標準GET請求從REST控制檯中檢索此信息。

使用這個網址爲例: https://soundcloud.com/maddecent/grandtheft-mobbin-feat

HTTP GET: https://api.soundcloud.com/resolve.json?url=https://soundcloud.com/maddecent/grandtheft-mobbin-feat&client_id=[client_id] 

返回:

{ 
    "status": "302 - Found", 
    "location": "https://api.soundcloud.com/tracks/107686148.json?client_id=[client_id]" 
} 

擊中軌道端點:

HTTP GET: https://api.soundcloud.com/tracks/107686148.json?client_id=[client_id] 

返回:

{ 
    "kind": "track", 
    "id": 107686148, 
    "created_at": "2013/08/28 17:24:39 +0000", 
    "user_id": 14730, 
    "duration": 186766, 
    "commentable": true, 
    "state": "finished", 
    "original_content_size": 9678964, 
    "last_modified": "2014/12/30 20:37:07 +0000", 
    "sharing": "public", 
    "tag_list": "Hedspin \"Mad Decent\" Jeffree's Dance Electronic Club Mobbin", 
    "permalink": "grandtheft-mobbin-feat", 
    "streamable": true, 
    "embeddable_by": "all", 
    "downloadable": false, 
    "purchase_url": "http://smarturl.it/GrandtheftMOB", 
    "label_id": null, 
    "purchase_title": "Buy on iTunes", 
    "genre": "", 
    "title": "Grandtheft - Mobbin feat. Hedspin", 
    "description": "Buy on iTunes: http://smarturl.it/GrandtheftMOB\r\nBuy on Beatport: http://bit.ly/GrandtheftBP\r\nBuy on Amazon: http://amzn.com/B00F4IFFQM\r\n\r\nRespected as one of the best live Canadian DJs in the game, Grandtheft has taken a break from globetrotting to pack in a HUGE release for Jeffree’s. Along with World Red Bull Thre3style champ and close pal Hedspin, they have made something minimal but fierce with their track 「Mobbin.」 The build channels the darkness of No Limit Records at its prime while the drop carries the bounce of a screwed and chopped new jack swing track. That, combined with the most menacing synth stab we’ve heard in a while, makes this tune unstoppable.\r\n\r\nWith 「Give Me More,」 Grandtheft lends us a soulful track that marries a delicious combination trap and dub in the same vein as his popular remix of Keys N Krates’ song 「Treat Me Right」 released off of Dim Mak. The juxtaposition of the drop is a total WTF moment for any club-goer and we mean that in the best way possible. Grandtheft’s momentum continues to pick up incredible speed with each release, and we don’t see his rise mellowing out anytime soon.\r\n\r\nGrandtheft\r\nSoundcloud: http://www.soundcloud.com/grandtheft\r\nFacebook: http://facebook.com/grandtheftmusic\r\nTwitter: https://twitter.com/grandtheft\r\nInstagram: http://instagram.com/itsgrandtheft\r\nYoutube: http://youtube.com/grandtheftofficial\r\n\r\nHedspin\r\nSoundcloud: https://soundcloud.com/hedspin\r\nFacebook: https://www.facebook.com/djhedspin\r\nTwitter: https://twitter.com/HEDSPIN\r\nInstagram: http://instagram.com/djhedspin", 
    "label_name": "Jeffree's", 
    "release": "JEFF060", 
    "track_type": "", 
    "key_signature": "", 
    "isrc": "US-Z4V-13-00221", 
    "video_url": null, 
    "bpm": null, 
    "release_year": 2013, 
    "release_month": 9, 
    "release_day": 17, 
    "original_format": "mp3", 
    "license": "all-rights-reserved", 
    "uri": "https://api.soundcloud.com/tracks/107686148", 
    "user": { 
     "id": 14730, 
     "kind": "user", 
     "permalink": "maddecent", 
     "username": "Mad Decent", 
     "last_modified": "2014/12/18 18:12:40 +0000", 
     "uri": "https://api.soundcloud.com/users/14730", 
     "permalink_url": "http://soundcloud.com/maddecent", 
     "avatar_url": "https://i1.sndcdn.com/avatars-000112599114-5etg3g-large.jpg" 
    }, 
    "permalink_url": "http://soundcloud.com/maddecent/grandtheft-mobbin-feat", 
    "artwork_url": "https://i1.sndcdn.com/artworks-000056426845-b40tmr-large.jpg", 
    "waveform_url": "https://w1.sndcdn.com/JL8flUq6Vn0x_m.png", 
    "stream_url": "https://api.soundcloud.com/tracks/107686148/stream", 
    "playback_count": 770622, 
    "download_count": 16462, 
    "favoritings_count": 16626, 
    "comment_count": 489, 
    "attachments_uri": "https://api.soundcloud.com/tracks/107686148/attachments", 
    "policy": "MONETIZE" 
} 

申購信息是JSON響應:

"purchase_url": "http://smarturl.it/GrandtheftMOB", 
"purchase_title": "Buy on iTunes",