Create a new fence (compliance) profile

Open in ChatGPT Open in ChatGPT to ask questions about this page
Open in Claude Open in Claude to ask questions about this page
Copy as MarkdownCopy this page as markdown to use with AI assistants
View as Markdown Open this page as markdown in a new tab

creates the fence policy

Endpoints

Request URL

https://{serverurl}/api/v1/mdm/compliance

Scope

MDMOnDemand.MDMInventory.CREATECopied!

Header

Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52

- Request Body

application/json
JSON object
Hide Sub-Attributes
compliance_namestringMandatory

Name of the compliance (fence) profile

descriptionstringOptional

Short description of the compliance profile

policiesJSON arrayMandatory

Collection of policy objects with rules and actions

Show Sub-Attributes
JSON object
Show Sub-Attributes
ruleJSON objectOptional

Rule details defining the geofence conditions

Show Sub-Attributes
rule_namestringOptional

Name of the compliance rule

evaluation_orderintegerOptional

Order in which this rule is evaluated

rule_criterionsJSON arrayOptional

Collection of criteria determining rule satisfaction/violation

Show Sub-Attributes
JSON object
Show Sub-Attributes
rule_criteria_typeintegerOptional

Type of rule criterion (e.g., 2 = Geofence)

geo_fence_idintegerOptional

Fence ID of the geofence boundary

rule_criteria_stateintegerOptional

State determining satisfaction or violation (e.g., 2 = outside fence)

actionJSON objectOptional

Action details defining responses to rule satisfaction/violation

Show Sub-Attributes
action_attributesJSON arrayOptional

Collection of actions performed on rule satisfaction/violation

Show Sub-Attributes
JSON object
Show Sub-Attributes
execution_orderintegerOptional

Order of execution of the action

time_to_executionintegerOptional

Time delay in seconds before executing the action

action_attribute_typeintegerOptional

Type of action (e.g., 1 = Lock device)

phone_numberlongOptional

Phone number to display on the lost device screen

lock_messagestringOptional

Message shown on the locked/lost device

unlock_pinstringOptional

PIN to unlock the device after locking

is_remote_alarmbooleanOptional

Whether remote alarm is initiated on the device

is_mark_as_non_compliantbooleanOptional

Whether the device is marked as non-compliant

alert_email_idsJSON arrayOptional

Array of email recipients notified on rule violation

Show Sub-Attributes
JSON object
Show Sub-Attributes
emailstringOptional

Email address of the user to alert

user_namestringOptional

Name of the user associated with the email address

subjectstringOptional

Subject line of the alert email/notification

body_messagestringOptional

Body of the alert describing the reason for the action

Sample Request

Curl
Java
Python
Deluge
PowerShell
Copied!
curl --request POST \
  --url https://appdomain/api/v1/mdm/compliance \
  --header 'Authorization: Zoho-oauthtoken  d92d4xxxxxxxxxxxxx15f52' \
  --header 'content-type: application/json' \
  --data '{"policies":[{}],"compliance_name":"GeoFencePolicy1"}'
▼ Show full

Sample Request Body

Create a fence policy with geofence rule and lock/email alert actions

Copied!
  {
    "policies": [
      {
        "rule": {
          "rule_name": "Tower",
          "evaluation_order": 1,
          "rule_criterions": [
            {
              "geo_fence_id": 1,
              "rule_criteria_state": 2,
              "rule_criteria_type": 2
            }
          ]
        },
        "action": {
          "action_attributes": [
            {
              "lock_message": "Device is lost",
              "body_message": "The device is outside its permitted fence.",
              "subject": "Warning",
              "is_remote_alarm": false,
              "is_mark_as_non_compliant": true,
              "alert_email_ids": [
                {
                  "user_name": "admin",
                  "email": "admin@zylker.com"
                }
              ],
              "action_attribute_type": 1,
              "time_to_execution": 0,
              "execution_order": 1
            }
          ]
        }
      }
    ],
    "description": "Compliance Profile",
    "compliance_name": "GeoFencePolicy1"
  }
                
▼ Show full

Response Parameters

- HTTP code 200

Response Body - application/json
JSON object
Hide Sub-Attributes
compliance_idstring

Profile ID of the created compliance profile

compliance_namestring

Name of the created compliance profile

collection_idstring

Collection ID assigned to the compliance

is_moved_to_trashboolean

Whether the compliance profile is deleted or not (false for newly created)

descriptionstring

Short description of the compliance profile

policiesJSON array

Collection of rule and action details for the created policy

Show Sub-Attributes
JSON object
Show Sub-Attributes
ruleJSON object

Rule details defining the geofence conditions

Show Sub-Attributes
rule_namestring

Name of the compliance rule

evaluation_orderinteger

Order in which this rule is evaluated

rule_idinteger

Rule ID of the policy

rule_criterionsJSON array

Collection of criteria determining rule satisfaction/violation

Show Sub-Attributes
JSON object
Show Sub-Attributes
rule_criteria_typeinteger

Type of rule criterion (e.g., 2 = Geofence)

geo_fence_idinteger

Fence ID of the geofence boundary

rule_criteria_stateinteger

State determining satisfaction or violation (e.g., 2 = outside fence)

actionJSON object

Action details defining responses to rule satisfaction/violation

Show Sub-Attributes
action_idlong

Action ID of the action

action_attributesJSON array

Collection of actions performed on rule satisfaction/violation

Show Sub-Attributes
JSON object
Show Sub-Attributes
execution_orderinteger

Order of execution of the action

time_to_executioninteger

Time delay in seconds before executing the action

action_attribute_typeinteger

Type of action (e.g., 1 = Lock device)

phone_numberlong

Phone number to display on the lost device screen

lock_messagestring

Message shown on the locked/lost device

unlock_pinstring

PIN to unlock the device after locking

is_remote_alarmboolean

Whether remote alarm is initiated on the device

is_mark_as_non_compliantboolean

Whether the device is marked as non-compliant

alert_email_idsJSON array

Array of email recipients notified on rule violation

Show Sub-Attributes
JSON object
Show Sub-Attributes
emailstring

Email address of the user to alert

user_namestring

Name of the user associated with the email address

subjectstring

Subject line of the alert email/notification

body_messagestring

Body of the alert describing the reason for the action

Possible Response Codes

200HTTP code

Sample Response: HTTP 200

Fence policy successfully created with assigned IDs

Copied!
  {
    "collection_id": "9007199254741048",
    "is_moved_to_trash": false,
    "policies": [
      {
        "rule": {
          "rule_id": 9007199254741084,
          "rule_name": "Tower",
          "evaluation_order": 1,
          "rule_criterions": [
            {
              "geo_fence_id": 1,
              "rule_criteria_state": 2,
              "rule_criteria_type": 2
            }
          ]
        },
        "action": {
          "action_id": 9007199254741084,
          "action_attributes": [
            {
              "lock_message": "Device is lost",
              "body_message": "The device is outside its permitted fence.",
              "subject": "Warning",
              "is_remote_alarm": false,
              "is_mark_as_non_compliant": true,
              "alert_email_ids": [
                {
                  "user_name": "admin",
                  "email": "admin@zylker.com"
                }
              ],
              "action_attribute_type": 1,
              "time_to_execution": 0,
              "execution_order": 1
            }
          ]
        }
      }
    ],
    "description": "Compliance Profile",
    "compliance_id": "9007199254741047",
    "compliance_name": "GeoFencePolicy1"
  }
                
▼ Show full

Duration: 1 minute | Threshold: 30 | Lock period: 5 minutes

Duration - Time window for the threshold.
Threshold - Number of API calls allowed within the specified duration.
Lock Period - Wait time before consecutive API requests.