I've been able to copy documents in document libraries using the "CopyTo" method: https://msdn.microsoft.com/en-us/library/office/dn450841.aspx#bk_FileCopyTo
I'm not understanding how I can apply this or any of the other exposed methods so that I can properly copy list item attachments. I've used the "Add" method (https://msdn.microsoft.com/en-us/library/office/dn292553%28v=office.15%29.aspx#FileAttachments) to successfully with plain text files, but this doesn't seem to work for any image types. The files open as corrupted. $.ajax({url: "something.com/myfile.txt"}) is what I've been using to "GET" the text files before using the method before using the copy method above on the result of the GET. Is there a different way I should go about this for non-plaintext files?
From the example that Microsoft provides on using the method:
url: http://site url/_api/web/lists/getbytitle('list title')/items(item id)/AttachmentFiles/ add(FileName='file name')
method: POST
headers:
Authorization: "Bearer " + accessToken
body: "Contents of file."
X-RequestDigest: form digest value
content-length:length of post body
I guess my question is around what I need to do to transform the result of my "GET" of a file so that I can use it as a variable with "body" here.