2

I am using Soundcloud AS3 library to build an application. I am able to create/get-all playlists for a user. But while updating an existing playlist, I don't understand the syntax by which I can specify the IDs of the tracks to put in that playlist. Basically, I am trying something like this:

var params:Object = {};
            params["playlist[id]"] = "1822522";
            params["playlist[title]"] = "Set 3";
            params["playlist[tracks][][id]"] = '41938358';
            params["playlist[tracks][][id]"] = '41938359';
            params["playlist[tracks][][id]"] = '41937715';

            playlistID = '1822522';

            var delegate:SoundcloudDelegate = soundcloudClient.sendRequest("playlists/" + playlistID, URLRequestMethod.POST, params);

In the documentation, it says that the request (for curl) has to be something like this:

curl -X PUT "https://api.soundcloud.com/playlists/98866.json" \
       -F 'oauth_token=A_VALID_TOKEN' \
       -F 'playlist[tracks][][id]=222'\
       -F 'playlist[tracks][][id]=333'\
       -F 'playlist[tracks][][id]=444'\
       -F 'playlist[tracks][][id]=555'

How do I create my playlists params to make the correct request.

P.S.- 41938358, etc. are my track IDs.

EDIT - while creating playlists, if I simply pass the name+description of a playlist, it works fine. But if I have to pass the list of track IDs, I cannot do it because of my faulty syntax.

halfer
  • 19,824
  • 17
  • 99
  • 186
  • I'm sorry; but am I missing how this question have anything to do with Flex? – JeffryHouser Apr 06 '12 at 02:07
  • Have you added listeners to the SoundcloudDelegate to get the success or failure response?, Also, it looks like you might want to double check the 1st parameter in sendRequest, maybe it should be `"playlists/" + playListID` ? Your params object seemed funny :) but that's apparently correct (based on the [quick start](https://github.com/dorianroy/Soundcloud-AS3-API/wiki/Quick-Start)) – Sunil D. Apr 06 '12 at 05:47
  • I am using this in a Flex application and am using the AS3 APIs to talk to soundcloud. –  Apr 06 '12 at 06:52
  • @SunilD. Yes, it should've been "playlists/" + id. My bad. It doesn't work even then. What I am unable to get correctly is to give the set of track IDs in the params object. Any ideas? –  Apr 06 '12 at 06:53

0 Answers0