Create Standard change through REST API?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-07-2016 11:50 AM
Is it possible to create a Standard change through the REST API? If so can you post an example or point to a reference?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-17-2017 04:32 AM
Hi Martin,
Interesting question!
There is a sample curl command mentioned in the docs
curl "https://instance.service-now.com/api/sn_sc/servicecatalog/items/3f1dd0320a0a0b99000a53f7604a2ef9/sub..." \
--request POST \
--header "Accept:application/json"\
--header "Content-Type:application/json" \
--data "{'variables':{'urgency':'2','comments':'This is sample incident'}}" \
--user 'admin':'admin'
{
"result": {
"record": "api/now/table/incident/1584f89767211200f579794717415a79,
"redirect_url": "incident.do?sys_id=1584f89767211200f579794717415a79&sysparm_view=ess"
}
}
I just tried a curl command towards the OOB record producer "Emergency Change" - without specifying the CI - which perhaps explains why the sys_parm_view is empty.
So half "pulled off" from my side
--request POST
--header "Accept:application/json" --header "Content-Type:application/json"
--data "{'variables':{'short_description':'short des'}}"
--user 'admin':'admin'
{
"result":{
"record":"api/now/table/change_request/a96b680913950700125ad8228144b0b7",
"redirect_url":"change_request.do?sys_id=a96b680913950700125ad8228144b0b7&sysparm_view="
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-17-2017 08:11 AM
Used the REST API Explorer to create Standard Change via the POST Record Producer method:
I
It created the change, and gave a redirect to the change record created.
See below screenshot of the resultant change:
And then, just like when working via the GUI, you would then use the Table API to update the resultant change record with the "non template" data required by the change.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-21-2019 01:59 PM
@Marting: Thank you for detailing the steps here. It looks like we would need two steps to create a change using standard change template, 1- Use the ServiceCatalog API to create the standard change & 2- Use the Table API to update the non template data required for that change.
My question: Is it possible to override the template data while making the API call to ServiceCatalog API so that the second call to the Table API can be avoided?
In our case, we would still want to utilize the capabilities of the standard change template via ServiceCatalog API, but would want the capability to override the template data.
Any suggestions or directions are appreciated!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-21-2019 02:00 PM
@Marting: Thank you for detailing the steps here. It looks like we would need two steps to create a change using standard change template, 1- Use the ServiceCatalog API to create the standard change & 2- Use the Table API to update the non template data required for that change.
My question: Is it possible to override the template data while making the API call to ServiceCatalog API so that the second call to the Table API can be avoided?
In our case, we would still want to utilize the capabilities of the standard change template via ServiceCatalog API, but would want the capability to override the template data.
Any suggestions or directions are appreciated!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-21-2019 09:30 PM
HI Rahul,
I don't believe you can override the template data without a second call.
But you may find you cannot event override it with a second call.
The while point about a standard change is that it is "standard". And when setting the standard change template up, you specify what fields are not be changed.
I haven't tested whether you can update these fields via REST call or not.
I guess the question is one of how the UI is locking the template fields. Client Script, UI Policy or Data Policy.
If the latter, then the REST api would also fail to update the template fields.
I will need to peek under the covers and see how template fields on a standard change get locked.