Hi, I have this C# code: Code: private void CreateTicketAttachment(IEnumerable<TicketAttachmentInfo> attachments, Ticket ticket) { foreach (var attachment in attachments) { var ticketAttachmentRequest = new TicketAttachmentRequest() { Contents = ConvertFileToBase64(attachment.TempFileName), FileName = attachment.FileName, TicketId = ticket.Id, TicketPostId = ticket.Posts.Max(p => p.Id) }; try { if (ticketAttachmentRequest.IsValid(RequestTypes.Create)) { _kayakoClient.Tickets.AddTicketAttachment(ticketAttachmentRequest); } } catch (InvalidOperationException invOp) { Message.Show(string.Format("AddTicketAttachment InvalidOperation: {0}", invOp.Message), MessageType.Error); } catch (ArgumentException argEx) { Message.Show(string.Format("AddTicketAttachment ArgumentException: {0}", argEx.Message), MessageType.Error); } catch (Exception ex) { Message.Show(string.Format("AddTicketAttachment exception: {0}", ex.Message), MessageType.Error); } finally { File.Delete(attachment.TempFileName); } } } Sometimes the attachment is added , but most of the times when adding I get this Exception: {"There is an error in XML document (1, 2)."} Looking at the inner exception I see this: {"<div xmlns=''> was not expected."} BTW: I am using the C# wrapper library. Any help would be appriciated. Thanks!
I have been digging around and it seems to me that the problem occurs when the function of converting a file to a base64 string returns a string with slashes. This will proberly terminate the XML command to the REST api or something. The base64 encoding works fine (tested this with the online tool [http://www.motobit.com/util/base64-decoder-encoder.asp]). Could this be a bug in the C# wrapper or the REST api?