AnsweredAssumed Answered

Feature Layer addAttachment() Returning HTML

Question asked by alindley on Dec 6, 2018
Latest reply on Dec 10, 2018 by alindley

Hey there,

I'm trying to use the addAttachment method introduced in 4.9, but it always returns an error:

Unexpected token < in JSON at position 0

even if the operation is successful. That's all I get returned from the call, but if I look at the network traffic I can see that the call was successful but is returning HTML when JSON is expected. 

 

Here is my code for the call, basically copied from the doc:

FeatureLayer.addAttachment(feature, form).then(function (result) {
  console.log('added successfully', result)
})
.catch(function (err) {
  console.log('err', err)
});

 

The FeatureLayerEditResult that is returned is always an error, even though I can see that the operation was successful and can access the newly added attachment from future attachment queries.

 

Do I need to explicitly request a JSON response somehow or something?

Outcomes