On page Update the Device Life Cycle State - CA Performance Management - 3.0 - CA Technologies Documentation
It shows an example of the URL syntax to make a "PUT" call to the devices/webservice. I used "get id names" as it recommends, and the only value showing is "deviceItemId", so when I build my curl statement as follows.
GET ID NAMES : returns
curl --verbose --insecure -u "user:Password" -X PUT "https://ecpm.mydomain.com:8181/pc/center/webservice/devices/deviceitemId/1504620/lifeCycleState/RETIRED"
I get the following response HTTP/1.1 500 Server Error.
* About to connect() to ecpm.cso.nasa.gov port 8181 (#0)* Trying 1xx.1xx.1xx.x... connected* Connected to ecpm.mydomain.com (1xx.1xx.xx.1xx) port 8181 (#0)* Initializing NSS with certpath: sql:/etc/pki/nssdb* warning: ignoring value of ssl.verifyhost* skipping SSL peer certificate verification* SSL connection using TLS_RSA_WITH_AES_256_CBC_SHA256* Server certificate:* subject: CN=ecpm.mydomain.com,OU=Services,OU=MYCOMPANY,O=irrelevant,C=US* start date: Jun 07 13:10:30 2017 GMT* expire date: Jun 07 13:40:30 2020 GMT* common name: ecpm.mydomain.com* issuer: ******************************************************* Server auth using Basic with user 'user'> PUT /pc/center/webservice/devices/deviceItemId/1504620/lifeCycleState/RETIRED HTTP/1.1> Authorization: Basic YWRtaW46SGFua0Bhcm9uMQ==> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.27.1 zlib/1.2.3 libidn/1.18 libssh2/1.4.2> Host: ecpm.mydomain.com:8181> Accept: */*>< HTTP/1.1 500 Server Error< Set-Cookie: JSESSIONID=16vdiad119cxx1ladhnc9kkyfq;Path=/pc;Secure< Connection: close< Server: Jetty(9.3.5.v20151012)<* Closing connection #0
I was able to get it to work with the below command:
curl -verbose -k -u "admin:admin" -X PUT "https://pcHostname:8182/pc/center/webservice/devices/deviceItemId/369/lifeCycleState/RETIRED"
I first went to the below URL in a browser to get the PC item id of a device to change (remember this is the PC id, NOT the id shown in Monitored Devices, that is the DA id of the device).
I also used -k instead of -insecure as it would not work to allow me to access the REST interface as I am using a self-signed certificate.
Thank you Troy. Many hours spent trying to figure this out.
My issue was that I was using the GUI / Administration / monitored devices / "Details" tab - the "Item ID" shown on that page (was my mistake in assuming) IS NOT the same number as the device/ItemID number returned from the "GET" devices xml output.
Once I used the correct number, everything works just like the documentation says.
I owe you one. Many Thanks!