Hello,

I have a web service running on a server. It is setup appropriately as I can test it with running the post request through a webpage.

I received the 409 when I don't have the Content-Type correct, but now I'm getting a 400 error with the code below. I'm not sure if it is still setup correctly as I can't use text/json as the ContentType. It is in many examples and it doesn't work for me. If I don't change the ContentType it is a 409 error.

I've checked the JSON file with http://jsonlint.com/ and it is valid. I still think I'm missing something for the call.

I'm using Visual Studio express.

Code:
               string myUrl = "http://dev1.whataremindsfor.com:26900/apiv1/transtext";
                string myData = "{ \"appkey\" : \"XXX\", \"appsecretkey\" : \"XXX\", \"conkey\" : \"XXX\", \"consecretkey\" : \"XXX\", \"ttsSpeakerType\" : \"usenglishfemale\", \"sentence\" : \"raise the temperature by 8\" }";

                var request = System.Net.WebRequest.Create(myUrl) as System.Net.HttpWebRequest;
                request.Method = "POST";
                request.ContentType = "application/json; charset=UTF-8";
                request.Accept = "application/json";
                //request.ContentType = "text/json";
                //request.Headers.Add("Content-Type", "form-data"); 
                //request.Headers.Add("Content-Type", "application/x-www-form-urlencoded"); 

                using (var writer = new System.IO.StreamWriter(request.GetRequestStream()))
                {
                    byte[] byteArray = System.Text.Encoding.UTF8.GetBytes(myData);  //getData
                    request.Headers.Add("ContentLength", byteArray.Length.ToString());
                    //request.ContentLength = byteArray.Length;
                    writer.Write(byteArray);
                    writer.Flush();
                    writer.Close();
                }

                string responseContent;
                using (var response = request.GetResponse() as System.Net.HttpWebResponse)
                {
                    using (var reader = new System.IO.StreamReader(response.GetResponseStream()))
                    {
                        responseContent = reader.ReadToEnd();
                    }
                }
                Console.WriteLine("responseContent:");
                Console.WriteLine("responseContent=" + responseContent);