string url = "http://drchrono.com/api/documents/";
var token = getCurrentToken();
HttpWebResponse response = null;
try
{
// Create the data to send
StringBuilder stringBuilder = new StringBuilder();
var headers = string.Format("{{'Authorization': 'Bearer {0}',}}", token.access_token);
stringBuilder.Append("headers=" + Uri.EscapeDataString(headers));
var data = "{'doctor': 1234,'patient': 5678,'description': 'Short document description here','date': '2014-02-24',}";
stringBuilder.Append("&data=" + Uri.EscapeDataString(data));
var pdfFileText = string.Format("{{'document': {0}}}", System.IO.File.ReadAllText(@"C:\Temp2\pdf_temp.pdf"));
stringBuilder.Append("&files=" + pdfFileText);
// Create a byte array of the data to be sent
byte[] byteArray = Encoding.UTF8.GetBytes(stringBuilder.ToString());
// Setup the Request
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "POST";
request.ContentType = "multipart/form-data";
request.ContentLength = byteArray.Length;
// Write data
Stream postStream = request.GetRequestStream();
postStream.Write(byteArray, 0, byteArray.Length);
postStream.Close();
// Send Request & Get Response
response = (HttpWebResponse)request.GetResponse();
using (StreamReader reader = new StreamReader(response.GetResponseStream()))
{
// Get the Response Stream
string json = reader.ReadLine();
Console.WriteLine(json);
}
}
catch (WebException e)
{
//The remote server returned an error: (404) Not Found.
}
It looks like you forgot the s.
I changed to https, but I am having the same error. Can someone please help?
--
You received this message because you are subscribed to the Google Groups "drchrono Medical Healthcare API SDK" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drchrono-api...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.