How to populate opened_at field when creating Incident using Rest API (POST)
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2018 03:43 PM
POST https://instance.service-now.com/api/now/table/incident
{
"opened_at": "javascript:gs.now()",
"assignment_group":"Group",
"category":"Network",
"cmdb_ci":"Ci",
"short_description":"Test REST API 2",
"subcategory":"Other",
"caller_id":"username"
}
How to specify current timestamp using POST Rest API
javascript:gs.now() - doesn't do anything in that case
Labels:
7 REPLIES 7
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2018 07:35 AM
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2018 08:49 AM
Request
POST https://instance.service-now.com/api/now/table/incident?sysparm_fields=opened_at
Headers
Accept
application/json
Content-Type
application/json
Request Body
{
"assignment_group":"AG",
"category":"Network",
"cmdb_ci":"CI",
"short_description":"Test REST API 2",
"subcategory":"Other",
"caller_id":"user_id"
}
Response
201 Created
Headers
cache-control
no-cache,no-store,must-revalidate,max-age=-1
content-type
application/json;charset=UTF-8
date
Tue, 19 Jun 2018 15:48:04 GMT
expires
0
location
https://instance.service-now.com/api/now/table/incident/39e63165dbb257407e7867c35b961931
pragma
no-store,no-cache
server
ServiceNow
strict-transport-security
max-age=63072000; includeSubDomains
transfer-encoding
chunked
x-is-logged-in
true
Response Body
{ "result": { "opened_at": "" } }

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2018 08:52 AM