- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2022 11:05 PM
Hi,
I have a system which only uses REST API to push data to ServiceNow. When the classification changes for a device (for example an OT device now is discovered to be a OT sensor), how should I update the record? PUT gives me a 404 if I try to PUT against the new table name with the same sys_id.
Is there a way to achieve the above without resorting to a DELETE and POST (create a new record in the new table)?
thanks,
Deepak
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2022 11:01 AM
I am checking the class with the "sys_class_name" attribute in the response as well. I just found out from another serviceNow expert that the {tableName} param should be target the highest common class between the input class and the replacement class in order to avoid the 404 error.
In my case, I was trying to move from "cmdb_ci_pc_hardware" to "cmdb_ci_server" - so when I set the {tableName} to "cmdb_ci_hardware", it worked!
Thanks for the pointers @RaghavSh . I am marking this as the solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2022 11:13 PM - edited 12-07-2022 11:15 PM
You dont need to put the sys_id as that is automatically generated, did you try to change the class name alone?
I dont think, servicenow will allow you to put sys_id explicitly.
Raghav
MVP 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2022 11:54 PM
I am using the REST API:
Table API
PUT https://<instance-url>/api/now/table/{tableName}/{sys_id}
It allows me to change the other attributes in the record, but not the sys_class_name
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2022 12:13 AM - edited 12-08-2022 12:14 AM
using same REST API explorer, I was just able to change the class from "cmdb_ci_computer" to "cmdb_ci_win_server" :
If you are using the correct request body check if there are some data policies or ACLs restricting the same, I did it in OOB instance.
Raghav
MVP 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2022 01:45 AM
@dcherian did you try this in OOB instance?
Raghav
MVP 2023