AnsweredAssumed Answered

How do I include a parameter of type 'esriFieldTypeDate ' in a POST request to FeatureService REST method applyEdits()?

Question asked by c_sharp_dotnet on Nov 28, 2017
Latest reply on Nov 29, 2017 by rvburton

I'm attempting to insert some records into my feature service using the applyEdits() method, however I'm receiving an error message because I'm not sure how to include data for a field in the feature service table that is of type 'esriFieldTypeDate'.  Here is some quick sample code - I have an object that contains my feature to be inserted:

 

var newFeature = {
   "geometry": {
      "x": -97.2736,
      "y": 32.8164
   },
   "attributes": {
      "SiteID": 999,
      "Name": "Test Site 1",
      "LeaseSigned": "12/1/2016, 9:00 AM"
   },
   "spatialReference": {
      "wkid": "102100"
   }
};

var features = [];
features.push(newFeature);

I also have an object that contains the input params for applyEdits():

var params= {
   f: 'json',
   adds: JSON.stringify(features),
   updates: "",
   deletes: "",
   gdbVersion: "",
   rollbackOnFailure: true,
   useGlobalIds: false,
   attachments: ""
};

 

However, I am receiving this error because I'm not sure how to format the input data for esriFieldTypeDate:

{
   "error":{
      "code": 400,
      "message":"Unable to complete operation.",
      "details":["Setting of value for LeaseSigned failed."]
   }
}

Does anybody know how to format the date time field correctly or can point me in the direction of some examples?  I've tried all different types of date formats but can't seem to figure this out.  Thanks!

Outcomes