private AdmAccessToken HttpPost(string DatamarketAccessUri, string requestDetails) { //Prepare OAuth request WebRequest webRequest = WebRequest.Create(DatamarketAccessUri); webRequest.ContentType = "application/x-www-form-urlencoded"; webRequest.Method = "POST"; byte[] bytes = Encoding.ASCII.GetBytes(requestDetails); webRequest.ContentLength = bytes.Length; using (Stream outputStream = webRequest.GetRequestStream()) { outputStream.Write(bytes, 0, bytes.Length); } using (WebResponse webResponse = webRequest.GetResponse()) { DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(AdmAccessToken)); //Get deserialized object from JSON stream AdmAccessToken token = (AdmAccessToken)serializer.ReadObject(webResponse.GetResponseStream()); return(token); } }