Click here to Skip to main content
15,910,358 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,
I am using 4shared rest api, and working on edit file information by http put. I coded like this:
C#
public void UpdateFile(string fileID, string accessToken, int uniqueID)
{
    Action<string> OnResponse = this.OnFileUpdate;
    string uri = string.Format("http://api.4shared.com/v0/files/fileID.json?oauth_token={1}&UniqueID={2}",accessToken,uniquesID);

    uri=uri + "&name=mayank&description=This is for testing.";
    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(new Uri(uri));            
    request.Method = "PUT";
    request.ContentType = "application/x-www-form-urlencoded";
    request.BeginGetResponse(delegate(IAsyncResult result)
    {
        HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(result);
        using (var stream = response.GetResponseStream())
        {
           using (StreamReader reader = new StreamReader(stream))
           {
               string response1 = reader.ReadToEnd();
               onResponseGot(response1);
           }
        }
    }, null);
}
    
private void OnFileUpdate(string result)
{
   if (!string.IsNullOrEmpty(result))
   {
      //do some code after file updates.
   }
}

Now I am getting response but with same old values. I also tried to test it on api console but result is same. I didn't find out the problem.
Posted
Updated 30-Sep-12 21:13pm
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900