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:
http:// <TSPShostname:port#>/tsws/10.0/api/unifiedadmin/MonitoringPolicy/<id>/update?idType=id

 

Example

http://tspspanna:80/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 policyand Example-use-case-scenarios-to-create-a-monitoring-policy. You must also specify the action attribute which specifies the type of update you want to perform on the attributes. The supported values are as follows:

  • add — Adds the attribute and its value for the policy
  • remove — Removes the specified attribute
  • update — Updates the attribute with the values you have provided
  • overwrite— Overwrites 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": "filterconf00",
               "type": "monitoring",
               "description": "",
               "tenant": {
                   "name": "tenant1",
                   "id": "tenant1"
               },
               "precedence": 75,
               "agentSelectionCriteria": "agentOS CONTAINS \"windows\" ",
               "associatedUserGroup": "BMCTenantAdmin",
               "owner": "test3",
               "filteringConfiguration": {
                   "scope": "monitors",
                   "configurations": [
                       {
                           "solutionName": "psx_epd",
                           "solutionVersion": "4.8.00",
                           "monitors": [
                               {
                                   "monitorType": "NT_SERVICES",
                                   "attributes": [
                                       {
                                           "attributeName": "__ANYPARAM__",
                                           "filter": "data&events",
                                           "regEx": false
                                       }
                                    ]
                               }
                            ]
                       }
                    ]
               },
               "enabled": true,
               "shared": true
           }
       }

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": "2015-03-22T20:55:20",
   "statusCode": "200",
   "statusMsg": "OK",
   "response": [
       {
           "resourceId": "cc97e46d-e967-43c5-96c0-0574d22a6222",
           "resourceName": "agentthresholdconfiguration11",
          "resourceURI": null,
           "statusCode": "200",
           "statusMsg": "OK",
           "bladeSetup": null,
           "monitoringPolicy": {
               "id": "cc97e46d-e967-43c5-96c0-0574d22a6222",
               "name": "agentthresholdconfiguration11",
               "type": "monitoring",
               "description": "",
               "tenant": {
                   "name": "tenant1",
                   "id": "tenant1"
               },
               "precedence": 45,
               "agentSelectionCriteria": "agentOS CONTAINS \"windows\" ",
               "associatedUserGroup": "BMCTenantAdmin",
               "owner": "",
               "enabled": true,
               "shared": false
           }
       }
    ]
}

Related topics

Creating-a-policy-using-web-services

Managing-policies-using-web-services

Performing-Central-Monitoring-Administration-functions-with-web-services

 

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