AnsweredAssumed Answered

JavaScript API esriRequest applyEdits to portal feature table

Question asked by lishirley89 on Sep 19, 2017
Latest reply on Oct 6, 2017 by jack.murray_Epoch

I'm sending an esriRequest to a feature table hosted on our portal to add new features via POST method

 

I use "esriConfig.request.maxUrlLength = 1; " which forces the request to use POST.  now the request goes through but nothing is posted...

 

esriConfig.portalUrl = "<portalURL>";

esriConfig.request.maxUrlLength = 1;

 

setTimeout(function(){
on(dom.byId("submitrecord"), "click", function(){
esriRequest('<featuretableURL>/applyEdits',{
query: {
method: 'POST',
adds: [
{
"attributes": {
"Notes": "code test",
"roomID": 1234
}
}
],
f:"json"
},
}).then(function(r){
console.log(r);
});


});
},5000);

 

I'm using JavaScript api 4.4. and applyedits for feature layer seems not working for tables. so I'm using the esriRequest

 

I also tried to directly send the request in the browser at '<featuretableURL>/applyEdits'. I copied the request body

 

[
{
"attributes": {
"Notes": "code test",
"roomID": 1234
}
}
]

 

to the "adds" box and it successfully added the feature. 

 

Any help is appreciated!

Outcomes