AnsweredAssumed Answered

How to call the Updating a user's picture API By C#?

Question asked by robbie on Sep 24, 2014
Latest reply on Sep 29, 2014 by robbie
when I call following method,then return the error message:Cannot send a content-body with this verb-type.How to build the request body?
The requestBodyData is byte[] data for the photo.

The sourceCode:
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create("http://serverName:8080/activiti-rest/service/kermit/picture");
                webRequest.Method = "GET";
                webRequest.ContentType = "multipart/form-data";
                webRequest.Timeout = 1000*60;

                CredentialCache setCredential = new CredentialCache();
                setCredential.Add(new Uri(requestUrl), "Basic", new NetworkCredential("kermit", "kermit"));
                webRequest.Credentials = setCredential;
                webRequest.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(new ASCIIEncoding().GetBytes("kermit"+ ":" + "kermit")));
                if (requestBodyData != null)
                {
                    webRequest.ContentLength = requestBodyData.Length;
                    Stream dataStream = webRequest.GetRequestStream();
                    dataStream.Write(requestBodyData, 0, requestBodyData.Length);
                    dataStream.Close();
                }
          HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse();

Outcomes