AnsweredAssumed Answered

Rest API Update Inactive CI

Question asked by Grant Bruneau Champion on Mar 13, 2018
Latest reply on Mar 13, 2018 by Grant Bruneau

Hi Community,

 

I'm working on a process to synchronize our SCCM environment with the CMDB using the RESTful API.  One problem I found is I'm not able to edit inactive CIs via REST but can update them in the UI and via SOAP.  Wondering if anyone else has noticed this and if there's a solution?  I opened a support case already but want to post here in case it's a simple fix.  The option allow_updates_to_inactive_ci is installed and set to Yes.

 

Here's an example of a working PUT operation (CI is Active).

PUT /caisd-rest/nr/U'7E2BF755E00C6248ACD5BA6CC045019D' HTTP/1.1
Host: hostname:8050
Content-Type: application/xml;charset=UTF-8
X-AccessKey: 1726620906
X-Obj-Attrs: delete_flag
Cache-Control: no-cache
Postman-Token: 09fd3093-042e-49d0-a4b2-c4ac8e089978
<nr id="U'7E2BF755E00C6248ACD5BA6CC045019D'">
<description>test</description>
</nr>

 

I'm able to inactivate the CI

PUT /caisd-rest/nr/U'7E2BF755E00C6248ACD5BA6CC045019D' HTTP/1.1
Host: hostname:8050
Content-Type: application/xml;charset=UTF-8
X-AccessKey: 1726620906
X-Obj-Attrs: delete_flag
Cache-Control: no-cache
Postman-Token: f79dd85a-6f98-47f1-a95c-3f426c162e29
<nr id="U'7E2BF755E00C6248ACD5BA6CC045019D'">
<delete_flag COMMON_NAME="Inactive"/>
</nr>

 

However, once it's inactive I can't update it.  The following PUT operation returns a HTTP 500 error with this error in the logs.

03/13 08:26:29.872 [http-nio-8050-exec-8] ERROR SDMCRUDServiceImpl 2061 Invalid number of rows (0) affected by the operation. Expecting (1). [UPDATE nr SET delete_flag=0 WHERE id = U'7E2BF755E00C6248ACD5BA6CC045019D'] {http://hostname:8050/caisd-rest/nr/U%277E2BF755E00C6248ACD5BA6CC045019D%27} 

 

PUT /caisd-rest/nr/U'7E2BF755E00C6248ACD5BA6CC045019D' HTTP/1.1
Host: hostname:8050
Content-Type: application/xml;charset=UTF-8
X-AccessKey: 1726620906
X-Obj-Attrs: delete_flag
Cache-Control: no-cache
Postman-Token: 266c1aa9-6de5-4f29-950f-c20ddef56ae9
<nr id="U'7E2BF755E00C6248ACD5BA6CC045019D'">
<delete_flag COMMON_NAME="Active"/>
</nr>

Outcomes