0

我正在使用 4shared rest api,并通过 http put 编辑文件信息。我这样编码:

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.
        }
    }

现在我得到了响应,但具有相同的旧值。我也尝试在 api 控制台上测试它,但结果是一样的。我没有发现问题。

4

0 回答 0