Unknown macro: {next_previous_link3}
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 14 Next »

Description

Add a policy using the 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 MethodPOST
Request/Response Formatapplication/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
  • For more information on how to generate the <EMM_API_TOKEN>, see Generating the EMM API Token.
  • Define the path to the JSON file, which includes the required properties to add a policy as the as the <JSON_PAYLOAD> value. For more information, see the Sample JSON Definition.
  • By default, <EMM_HOST> is localhost. However, if you are using a public IP, the respective IP address or domain needs to be specified.
  • By default, <EMM_HTTPS_PORT> has been set to 9443. However, if the port offset has been incremented by n, the default port value needs to be incremented by n.

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":[]
}
Property valueDescription
policyName

The name of the policy.

DescriptionProvide a description on what the policy is based on.
Compliance

Define the non-compliance rules. WSO2 EMM provides the following non-compliance rules:

  • Enforce - Forcefully enforce the policies on the devices.
  • Warning - If the device does not adhere to the given policies a warning message will be sent.
  • Monitor - If the device does not adhere to the given policies the server is notified of the violation unknown to the user and the administrator can take the necessary actions with regard to the reported.
ownershipType

Define the define ownership type using the values given below:

  • ANY - The policy will be applied on the BYOD and COPE device types.
  • BYOD (Bring Your Own Device) - The policy will only be applied on the BYOD device type.
  • COPE (Corporate-Owned, Personally-Enabled) - The policy will only be applied on the COPE device type.
profileProvide the policy profile details.
profileNameThe name of the policy that is being added.
deviceType

The ID used to define the type of the device platform.

For more information on the unique ID for the device platforms supported by the EMM, see Getting Details of the Devices Supported via WSO2 EMM.

profileFeaturesList Lists the features that belong to the profile.
featureCode

Provide the code that defines the policy you wish to add.

Example: PASSCODE_POLICY, CAMERA and ENCRYPT_STORAGE.

deviceTypeIdThe ID used to define the type of the device platform.
content

The list of parameters that define the policy.

For more information on the feature list for Windows policies, see profileFeaturesList - policy based.

enabled

In the context of adding a policy for cameras. The filed is used to define if the camera on the device is permitted to be used or not.

  • true - The camera is enabled.
  • false - the camera is disabled.
usersDefine the users the policy needs to be applied on. The policy will be applied on the respective users devices.
rolesDefine the roles the policy needs to be applied on. The policy will be applied on the respective user roles devices.

If you wish to add a new policy criteria that what is already supported (users and roles) you can do so by defining a anew policy criteria within the "policyCriterias":[] field.

  • No labels