API and DELETE policy by ID

Sonic84
Contributor III

I'm trying to delete a policy vie the API, however I'm getting "400 bad request" in return. My account has full admin rights and I can GET, PUT, and POST just fine to the same policy. DELETE works for other stuff like Categories and Buildings. I double checked the policy list and I'm trying to delete the right policy ID. Am I missing something simple?

example:
curl -v -uadmin -p https://my.jss.com:8443/JSSResource/policies/id/48 -X DELETE

response:
< HTTP/1.1 400 Bad Request
< Transfer-Encoding: chunked
< Date: Thu, 29 Sep 2016 02:46:09 GMT
< Connection: close
< Server: Apache

1 ACCEPTED SOLUTION

Sonic84
Contributor III

nevermind, figured it out. Forgot to quote my URL string....

does not work: curl -v -uadmin -p https://my.jss.com:8443/JSSResource/policies/id/48 -X DELETE

works:
curl -v -uadmin -p "https://my.jss.com:8443/JSSResource/policies/id/48" -X DELETE

also, if you want curl to output the HTTP response code, add this: -w " response code:%{http_code} "
makes error checking a lot easier.

View solution in original post

1 REPLY 1

Sonic84
Contributor III

nevermind, figured it out. Forgot to quote my URL string....

does not work: curl -v -uadmin -p https://my.jss.com:8443/JSSResource/policies/id/48 -X DELETE

works:
curl -v -uadmin -p "https://my.jss.com:8443/JSSResource/policies/id/48" -X DELETE

also, if you want curl to output the HTTP response code, add this: -w " response code:%{http_code} "
makes error checking a lot easier.