tomrip

10.1 REST API date update using SQL Server functions

Discussion created by tomrip on Nov 4, 2013
Hello.

I am hoping to use the AGS 10.1 REST API to update my 'last changed date' field to a date/time value generated by my SQL Server database.  So far I have not had any good luck.

My feature layer has this data field:
last_change_date ( type: esriFieldTypeDate , alias: last_change_date , editable: true , nullable: true , length: 36 )

I have tried REST update requests that look like this (only the relevant parts included):

"attributes": {
"last_change_date": CURRENT_TIMESTAMP,
}

and this

"attributes": {
"last_change_date": GetDate(),
}

but in both cases I get the standard error JSON response
{
"error": {
  "code": 400,
  "message": "Unable to complete operation.",
  "details": [
   "Operation rolled back."
  ]
}
}

And the AGS logs say this: Setting of Value for Property: last_change_date in Layer: xxx failed.


I can successfully use the CURRENT_TIMESTAMP and GetDate SQL Server functions in the where clause of a REST request, but can i use those functions to set the value of field?  If so, what's the correct syntax?

Thank you.

Outcomes