I am attempting to pull an attachment and serve it up in an API. I am consistently getting a bad request error, And I cannot see to understand why this is not producing the byte stream I am looking for. Can someone take a look and offer insight?
A couple points: I am validating into SFDC without issue. I have tried to do this through an async query instead and have only gotten a link that does not help.
var req = (HttpWebRequest)WebRequest.CreateHttp(Properties.Settings.Default.url3 + documentId + "/body "); req.Headers.Add("Authorization: Bearer " + Properties.Settings.Default.token); req.Method = "GET"; WebResponse resp; byte doc = null; String content; Console.Write(req); resp = req.GetResponse(); StreamReader sr = new StreamReader(resp.GetResponseStream(), System.Text.Encoding.GetEncoding("UTF-8")); content = sr.ReadToEnd(); doc = Convert.FromBase64String(content); return doc;