Forum Post: Attachment not working for REST API call.

  • Thread starter Thread starter anu31221@gmail.com
  • Start date Start date
Status
Not open for further replies.
A

anu31221@gmail.com

Guest
Attachment not working for REST API call. We are not able to attach a file in Lead/Contact after record creation. Is there any change in API. Are we passing correct key value pair string base64String; byte[] byteArray = System.IO.File.ReadAllBytes(mypath); try { base64String = System.Convert.ToBase64String(byteArray, 0, byteArray.Length); } catch (System.ArgumentNullException) { System.Console.WriteLine("Binary data array is null."); return; } string urlattachmen = string.Format("{0}setBinaryData?sessionId={1}&id={2}&fieldName =file&value=base64Strin&contentType="application/pdf"&value={5}", API_Method.Utils.GlobalURL, Globals.ThisAddIn.SessionID, id, file, base64String,"application/pdf ", "Profile.pdf"); System.Net.WebRequest reqs = System.Net.WebRequest.Create(urlattachmen); //true means no proxy System.Net.WebResponse resps = reqs.GetResponse(); System.IO.StreamReader srs = new System.IO.StreamReader(resps.GetResponseStream()); string result = srs.ReadToEnd().Trim();/

Continue reading...
 
Status
Not open for further replies.
Back
Top