Hi all 
I have a feature layer that has attachments.
Using the javascript api I can query the feature layer for attachments using the queryFeatureAttachments method
eg
fl<SPAN class="punctuation token">.</SPAN><SPAN class="token function">queryFeatureAttachments</SPAN><SPAN class="punctuation token">(</SPAN>feature<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="token function">then</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">function</SPAN><SPAN class="punctuation token">(</SPAN>attachments<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">for</SPAN> <SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">var</SPAN> x <SPAN class="operator token">=</SPAN> <SPAN class="number token">0</SPAN><SPAN class="punctuation token">,</SPAN> xl <SPAN class="operator token">=</SPAN> info<SPAN class="punctuation token">.</SPAN>length<SPAN class="punctuation token">;</SPAN> x <SPAN class="operator token"><</SPAN> xl<SPAN class="punctuation token">;</SPAN> x<SPAN class="operator token">++</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
console<SPAN class="punctuation token">.</SPAN><SPAN class="token function">log</SPAN><SPAN class="punctuation token">(</SPAN>attachments<SPAN class="punctuation token">[</SPAN>x<SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>So I now have the attachments and I can log them to console.
My question is how do I attach these attachments to a feature in another feature service?
There is no method in the javascript api 4.x to add an attachment
Has anyone worked out a way to do this? I was thinking of using the rest api Add Attachment—ArcGIS REST API: Services Directory | ArcGIS for Developers but I'm not sure what the post object should look like?
Any help here would be much appreciated
Thanks
James