Search code examples
c#apisoundcloud

SoundCloud API Failing on track comment


I am trying to consume SoundCloud API in .NET application. I need to post a comment for a predefined track. I am using the following code:

byte[] response = client.UploadValues(String.Format
("https://api.soundcloud.com/tracks/{0}/comments.json?oauth_token={1}&comment={2}",
trackID, token, txtComment.Text), "PUT", new NameValueCollection()
{
    { "body", "Comment" }
});

I receive The remote server returned an error: (404) Not Found. The result is the same when I use soundcloud console http://developers.soundcloud.com/console.

Do I miss something? Or is there another way to post a comment to a track using the API?


Solution

  • I found the solution of my issue. It is here: How to add comments through the SoundCloud API

    My code should look like this:

    byte[] response = client.UploadValues(String.Format
    ("https://api.soundcloud.com/tracks/{0}/comments.json?oauth_token={1}&comment={2}",
    trackID, token, txtComment.Text), "POST", new NameValueCollection()
    {
        { "comment[body]", "Comment" }
    });