AnsweredAssumed Answered

Add attachment with javascript api 4.x

Question asked by TGS_james on Aug 2, 2018
Latest reply on Oct 22, 2018 by jgrayson-esristaff

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.queryFeatureAttachments(feature).then(function(attachments){
for (var x = 0, xl = info.length; x < xl; x++) {
   console.log(attachments[x]);
  };
});

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

Outcomes