Updating a policy


The update API uses the PUT method to update a policy. You must provide authentication credentials by using the login API before updating the policy. For information about the authentication process, see Web services authentication.

URL to access the update API

The generic format of a URL for the update API is as follows:
https://<TSPShostname>:<port>/tsws/10.0/api/unifiedadmin/MonitoringPolicy<id>/update?idType=id

Example

https://tsps105:443/tsws/10.0/api/unifiedadmin/MonitoringPolicy/
policy203/update?&idType=name

Input parameters in the JSON format for the update API

When you provide input parameters for any web service request, you must specify the content-type parameter in the header of the web service request as follows:

content-type application/json

You can provide the attributes that you want to update as input parameters. For information about the attributes, see List of input parameters to create a blackout policy, List of input parameters to create a staging policy and Example-use-case-scenarios-to-create-a-monitoring-policy.

You must also specify the action attribute with any of the following values:

  • add— Adds the list of specified attributes and their details for the policy.
  • update— Updates the list of specified attributes and their details for the policy.
  • overwrite— Overwrites the list of specified attributes and their details for the policy.
  • remove— Removes the list of specified attributes and their details for the policy.

Sample input parameters in the JSON format are as follows: 

Sample input parameters for the update API to update a policy

{
{
     "monitoringPolicy": {
       "name": "SimpleMonitoringPolicy",
       "type": "monitoring",
       "description": "",
       "tenant": {
         "name": "policyRealm",
         "id": "policyRealm"
       },
       "precedence": 900,
       "agentSelectionCriteria": "agentTag EQUALS \"AgentTag\" ",
       "associatedUserGroup": "Administrators",
       "owner": "PolicyAdmin",
       "filteringConfiguration": {
         "scope": "monitors",
         "configurations": [
           {
             "solutionName": "vsn",
             "solutionVersion": "3.1.00",
             "monitors": [
               {
                 "monitorType": "VSM_XEN_HOST",
                 "attributes": [
                   {
                     "attributeName": "__ANYPARAM__",
                     "filter": "data",
                     "regEx": false
                   }
                  ]
               }
              ]
           },
                                               {
             "solutionName": "psx_epd",
             "solutionVersion": "4.8.10",
             "monitors": [
               {
                 "monitorType": "AD_AD_SERVER",
                 "attributes": [
                   {
                     "attributeName": "__ANYPARAM__",
                     "filter": "data",
                     "regEx": false
                   }
                  ]
               },
               {
                 "monitorType": "NT_BSK",
                 "attributes": [
                   {
                     "attributeName": "__ANYPARAM__",
                     "filter": "data",
                     "regEx": false
                   }
                  ]
               }
              ]
           }
          ],
          "action":"add"
       },
       "enabled": false,
       "shared": false
     }
   }

Note

The policy ID is generated through Infrastructure Management and cannot be changed through the update API.

Response information for the update API

A sample JSON response is as follows:

{
 "responseTimeStamp": "2016-09-23T17:57:19",
 "statusCode": "200",
 "statusMsg": "OK",
 "response": [
   {
     "resourceId": "bd216487-2ba6-4a41-bc13-58149623a9eb",
     "resourceName": "SimpleMonitoringPolicy",
     "statusCode": "200",
     "statusMsg": "OK",
     "monitoringPolicy": {
       "id": "bd216487-2ba6-4a41-bc13-58149623a9eb",
       "name": "SimpleMonitoringPolicy",
       "type": "monitoring",
       "description": "",
       "tenant": {
         "name": "*",
         "id": "*"
       },
       "precedence": 900,
       "agentSelectionCriteria": "agentTag EQUALS \"AgentTag\" ",
       "associatedUserGroup": "Administrators",
       "owner": "PolicyAdmin",
       "creationTime": 1474633490961,
       "enabled": false,
       "shared": false
     }
   }
  ]
}

Related topics

Creating-a-policy-using-web-services

Managing-policies-using-web-services

Performing-infrastructure-monitoring-functions-with-web-services

 

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