Adding a Policy via the Console
Description | Add a policy using this REST API command. When adding a policy you will have the option of saving the policy or saving and publishing the policy. Using the REST API command given below you are able to save a created Policy and this policy will be in the inactive state.
| ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Resource Path | /inactive-policy | ||||||||||||||||||||||||||||||
URL | /mdm-admin/policies/inactive-policy
| ||||||||||||||||||||||||||||||
HTTP Method | POST | ||||||||||||||||||||||||||||||
Request/Response Format | application/json | ||||||||||||||||||||||||||||||
cURL command | curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer <EMM_API_TOKEN>" -d @'<JSON_PAYLOAD>' -k -v https://<EMM_HOST>:<EMM_HTTPS_PORT>/mdm-admin/policies/inactive-policy
Example: curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer 33392fb365b3ac693b405b565ddc8a3a" -d @'policy.json' -k -v https://localhost:9443/mdm-admin/policies/inactive-policy | ||||||||||||||||||||||||||||||
Sample output | > POST /mdm-admin/policies/inactive-policy HTTP/1.1 > Host: localhost:9443 > User-Agent: curl/7.43.0 > Accept: */* > Content-Type: application/json > Authorization: Bearer 33392fb365b3ac693b405b565ddc8a3a > Content-Length: 420 < HTTP/1.1 201 Created < Date: Thu, 25 Feb 2016 06:30:18 GMT < Content-Type: application/json < Content-Length: 76 < Server: WSO2 Carbon Server {"statusCode":201,"messageFromServer":"Policy has been added successfully."} | ||||||||||||||||||||||||||||||
Sample JSON Definition | { "policyName":"Camera", "description":"Optional", "compliance":"enforce", "ownershipType":"ANY", "profile":{ "profileName":"Camera", "deviceType":{ "id":1 }, "profileFeaturesList":[ { "featureCode":"CAMERA", "deviceTypeId":1, "content":{ "enabled":true } } ] }, "users":[], "roles":[] }
If you wish to add a new policy criteria than what is already supported (users and roles) you can do so by defining a new policy criteria within the " |