Is it possible to change sys_class_name via REST API?

dcherian
Giga Expert

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

1 ACCEPTED SOLUTION

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

View solution in original post

9 REPLIES 9

Thanks @RaghavSh for trying it out. But I did not try it on an OOB instance. Do you know what is the minimum role the API user should have. I have admin and itil. 

@dcherian i had admin role.


Raghav
MVP 2023

Actually, don't you have to set the {tableName} param to the new table name in your REST endpoint?

I tried as your did against the old tableName. It did not actually change the class though it gave a 200 response. Please check the response body. Thanks.

How are you checking the class, in my case the CI moves from computer class to window class.

The {tableName} param was old table name only.

Did you try in oob instance? Can you send the entire page screenshot?


Raghav
MVP 2023

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