AnsweredAssumed Answered

REST API for adding a record

Question asked by ndilekli on May 22, 2017
Latest reply on May 23, 2017 by ndilekli

I would like to add records to a table using REST API. I followed Robert Scheitlin, GISP's example to retrieve a table here, and modified the URL with the following one:

"[{'attributes' : {'agree_with_incident' : '2', 'notes' : 'my notes..'}}]&f=json";

based on Domenico Ciavarella's answer in this post. However, I am getting this error in the console when I try to execute the request: " error Error: Unable to complete operation." 


I am very new to the REST API, and I don't see many examples. Here is my entire code


<!DOCTYPE html>
  <meta charset="utf-8">
  <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
  <title>Add a Record</title>
    td {
      padding: 4px;

    #loading {
      visibility: hidden;

  <script src=""></script>

    ], function(esriRequest, esriConfig, JSON, dom, on) {

      esriConfig.request.proxyUrl = "http://gislap183/js/proxy/proxy.ashx";

      function doRequest(){
        var url = "[{'attributes' : {'agree_with_incident' : '2', 'notes' : 'my notes..'}}]&f=json";
        esriRequest(url, {
          responseType: "json",
          callbackParamName: "callback"

      var resultsTable = dom.byId("tbl");

      // Executes when the promise from find.execute() resolves
      function showResults(response) {
        var results =;
        // Clear the cells and rows of the table to make room for new results
        resultsTable.innerHTML =  JSON.stringify(results);

      // Executes each time the promise from find.execute() is rejected.
      function rejectedPromise(err) {
        console.error("Promise didn't resolve: ", err.message);

      // Run doRequest() when button is clicked
      on(dom.byId("execBtn"), "click", doRequest);

  <input type="button" value="Execute" id="execBtn" />
  <table id="tbl"></table>


How can I fix this? Thanks.