Policy APIs


This topic describes the REST APIs for the policies in BMC Helix Automation Console.

The base URL for the Policy API is: https://<serverName>/api/v1

GET/api/v1/policies/tssa/groups/{type}

Retrieves all the static groups that are defined in TrueSight Server Automation.

Request body

Parameter

Description

page

Retrieves the results for a specified page number. The value starts with 0.

By default, all results appear on a single page.

size

Specifies the number of items to be displayed on a single page.

type

Specifies the filter on a static group type.

Available values: server, job, depot, component, component_template

Responses

Code

Description

200

OK

401

Unauthorized

403

Forbidden

404

Not Found

GET/api/v1/policies/tssa/smart-groups/{type}

Retrieves all the dynamic groups that are defined in BMC Helix Automation Console.

Request body

Parameter

Description

page

Retrieves the results for a specified page number. The value starts with 0.

By default, all results appear on a single page.

size

Specifies the number of items to be displayed on a single page.

type

Specifies the filter on a static group type.

Available valuesserver, job, depot, component, template, device, windowspatch, redhatpatch, solarispatch, susepatch, aixpatch, debianpatch, rpmlinuxpatch

Responses

Code

Description

200

OK

401

Unauthorized

403

Forbidden

404

Not Found

GET/api/v1/policies/search

Retrieves all the policies.

Request body

Parameter

Description

filter

Specifies the filter properties.

Available values : policy_id, policy_name, policy_type, bsa_policy.catalog.id, properties.os, properties.scan_policy_id, status, os_type

page

Retrieves the results for a specified page number. The value starts with 0.

By default, all results appear on a single page.

size

Specifies the number of items to be displayed on a single page.

sort

Sorts on the specified field and format.

Available values: policy_name, os_type, duration, start_time, status

Default value: policy_name:asc


Responses

Code

Description

200

OK

401

Unauthorized

403

Forbidden

404

Not Found

Sample response 

[
 {
   "policy_id": "string",
   "policy_name": "string",
   "policy_type": "string",
   "os_type": "WINDOWS",
   "is_enabled": true,
   "created_by": "string",
   "description": "string",
   "properties": {},
   "status": "string",
   "last_update": 0,
   "next_scheduled_update": 0,
   "created_at": 0,
   "modified_at": 0,
   "location": "string",
   "bsa_policy": {},
   "total_records": 0,
   "duration": 0,
   "start_time": 0
 }
]

GET/api/v1/policies/

Retrieves all the policies.

Request body

Parameter

Description

filter

Specifies the filter properties.

Available values: policy_id, policy_name, policy_type, bsa_policy.catalog.id, properties.os, properties.scan_policy_id, status, os_type

page

Retrieves the results for a specified page number. The value starts with 0.

By default, all results appear on a single page.

size

Specifies the number of items to be displayed on a single page.

sort

Sorts on the specified field and format.

Available values: policy_name, os_type, duration, start_time, status

Default value: policy_name:asc


Responses

Code

Description

200

OK

401

Unauthorized

403

Forbidden

404

Not Found

Sample response 

{
 "total_records": 0,
 "policies": [
   {
     "policy_id": "string",
     "policy_name": "string",
     "policy_type": "string",
     "os_type": "WINDOWS",
     "is_enabled": true,
     "created_by": "string",
     "description": "string",
     "properties": {},
     "status": "string",
     "last_update": 0,
     "next_scheduled_update": 0,
     "created_at": 0,
     "modified_at": 0,
     "location": "string",
     "bsa_policy": {},
     "total_records": 0,
     "duration": 0,
     "start_time": 0
   }
  ]
}

GET/api/v1/policies/{policy_id}

Retrieves the information for a specific policy ID.

Request body

Parameter

Description

policy_id

Specifies a policy ID.

Responses

Code

Description

200

OK

401

Unauthorized

403

Forbidden

404

Not Found

POST/api/v1/policies

Creates a new policy.

Request body: No parameters

Sample request

{
 "policy_id": "string",
 "policy_name": "WindowsScanPolicy",
 "policy_type": "scan",
 "os_type": "WINDOWS",
 "is_enabled": true,
 "bsa_policy": {
   "name": "WindowsScanPolicy",
   "description": "WindowsScanPolicy",
   "group": {
     "path": "/TSSA_Jobs"
    },
   "catalog": {
     "id": 200001
    },
   "analysis": {
     "windows": {
       "group": {
         "security_patches": true,
         "security_tools": true,
         "non_security_patches": true,
         "exclude_service_packs": true
        },
       "list": {
         "patch_list": {
           "include": [
             0
            ],
           "exclude": [
             0
            ]
          },
         "patch_group_list": {
           "include": [
             0
            ],
           "exclude": [
             0
            ]
          }
        }
      }
    },
   "targets": {
     "server_groups": [
        {
         "id": 200001
        }
      ],
     "servers": [
        {
         "id": 200001
        }
      ]
    },
   "schedules": [
      {
       "once": {
         "datetime": "string"
        },
       "daily": {
         "time": "string"
        },
       "weekly": {
         "days": [
           "string"
          ],
         "frequency": 0,
         "time": "string"
        },
       "monthly": {
         "week_day": "string",
         "week_of_month": "string"
        },
       "interval": {
         "days": 0,
         "hours": 0,
         "minutes": 0
        },
       "timezone": "string"
      }
    ]
  },
 "created_by": "BLAdmin",
 "description": "WindowsScanPolicy",
 "properties": {
   "prop1": "2055",
   "prop2": "windows"
  },
 "connector_type": "bsa"
}


Responses

Code

Description

200

OK

201

Created

401

Unauthorized

403

Forbidden

404

Not Found

POST/api/v1/policies/tssa/groups/{type}

Creates a static group in TrueSight Server Automation.

Request parameters

Parameter

Description

type

Specifies the type of a static group to be created.

Available values: server, job, depot, component, component_template


Responses

Code

Description

200

OK

201

Created

401

Unauthorized

403

Forbidden

404

Not Found

POST/api/v1/policies/reports/patch-compliance

Retrieves the patch compliance results for a policy.

Request body: No parameters

Request sample

{
 "filters": [
   {
     "severity": [
       "0",
       "1",
       "2",
       "3",
       "4",
       "5"
      ]
   },
   {
     "os": [
       "Windows"
      ]
   },
   {
     "policy": "d41cedbb-a981-4a46-b658-1111"
   }
  ]
}


Responses

Code

Description

200

OK

204

Content Not Found

401

Unauthorized

Sample response

[
 {
   "platform": "string",
   "missing_count": 0,
   "installed_count": 0
 }
]

POST/api/v1/policies/reports/patch-compliance/detail

Retrieves the patch compliance details for a policy.

Request body: No parameters

Sample request

{
 "filters": [
   {
     "severity": [
       "0",
       "1",
       "2",
       "3",
       "4",
       "5"
      ]
   },
   {
     "os": [
       "Windows"
      ]
   },
   {
     "policy": "d41cedbb-a981-4a46-b658-1111"
   }
  ]
}


Responses

Code

Description

200

OK

204

Content Not Found

401

Unauthorized

Sample response

[
 {
   "platform": "string",
   "missing_count": 0,
   "installed_count": 0,
   "policy_name": "string",
   "target_count": 0
 }
]

PUT/api/v1/policies/{policy_id}

Updates an existing policy.

Request parameters

Parameter

Description

policy_id

Specifies a policy ID.

Sample request

{
 "policy_id": "string",
 "policy_name": "WindowsScanPolicy",
 "policy_type": "scan",
 "os_type": "WINDOWS",
 "is_enabled": true,
 "bsa_policy": {
   "name": "WindowsScanPolicy",
   "description": "WindowsScanPolicy",
   "group": {
     "path": "/TSSA_Jobs"
    },
   "catalog": {
     "id": 200001
    },
   "analysis": {
     "windows": {
       "group": {
         "security_patches": true,
         "security_tools": true,
         "non_security_patches": true,
         "exclude_service_packs": true
        },
       "list": {
         "patch_list": {
           "include": [
             0
            ],
           "exclude": [
             0
            ]
          },
         "patch_group_list": {
           "include": [
             0
            ],
           "exclude": [
             0
            ]
          }
        }
      }
    },
   "targets": {
     "server_groups": [
        {
         "id": 200001
        }
      ],
     "servers": [
        {
         "id": 200001
        }
      ]
    },
   "schedules": [
      {
       "once": {
         "datetime": "string"
        },
       "daily": {
         "time": "string"
        },
       "weekly": {
         "days": [
           "string"
          ],
         "frequency": 0,
         "time": "string"
        },
       "monthly": {
         "week_day": "string",
         "week_of_month": "string"
        },
       "interval": {
         "days": 0,
         "hours": 0,
         "minutes": 0
        },
       "timezone": "string"
      }
    ]
  },
 "created_by": "BLAdmin",
 "description": "WindowsScanPolicy",
 "properties": {
   "prop1": "2055",
   "prop2": "windows"
  },
 "connector_type": "bsa"
}

Responses

Code

Description

200

OK

201

Created

401

Unauthorized

403

Forbidden

404

Not Found

DELETE/api/v1/policies/{policy_id}

Deletes a specific policy from BMC Helix Automation Console.

Request body

Parameter

Description

poicy_id

Specifies a policy ID.

 Responses

Code

Description

200

OK

204


401

Unauthorized

403

Forbidden



 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*

Helix Automation Console 19.11