Page tree

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

URL to create a policy

The generic format of a URL for the create API is as follows: 

http|https://<serverHost>:<port>/bppmws/api/unifiedadmin/
<policyType>/create

Example

http://bppmwsserver:80/bppmws/api/unifiedadmin/BlackoutPolicy/create

Entry

Description

http|https

Type of protocol to send the request. Infrastructure Management support both HTTP and HTTPS protocols.

serverHost

Host name of the BMC TrueSight Infrastructure Management Server that has Central Monitoring Administration

port

Port number through which communication is established. The default port number is 80 if you use the HTTP protocol and 443 if you use the HTTPS protocol.

policyType

Type of policy that you want to create. The supported policy types are:

  • MonitoringPolicy — Indicates that you are creating a monitoring policy
  • BlackoutPolicy — Indicates that you are creating a blackout policy
  • StagingPolicy — Indicates that you are creating a staging policy

Input parameters in the JSON format to create a policy

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

The input parameters vary according to the policy you create. For information about the input parameters, see Example use case scenarios to create a blackout policy and Example use case scenarios to create a staging policy.

Sample input parameters in the JSON format are as follows:

Sample input parameters for the create API to create a blackout policy

{
    "blackoutPolicy": {
        "blackoutStartStopEvents": false, 
        "blackoutTypes": [
            "data"
        ], 
        "timeframe": {
            "name": "timeframe123"
        }, 
        "agentSelectionCriteria": "agentVersion GREATER_OR_EQUALS \"10.0\"", 
        "precedence": 999, 
        "tenant": {
            "name": "Calbro"
        }, 
        "enabled": true, 
        "name": "policy121_blackout", 
        "type": "blackout", 
        "description": "description", 
        "scope": "completeAgent"
    }
}

The policy ID is generated through Infrastructure Management and cannot be created through the create API.

Response information for the create API

A sample JSON response is as follows:

{
    "response": [
        {
            "name": "policy121_blackout", 
            "statusCode": "200", 
            "statusMsg": "Successfully created policy", 
            "policyId": "id_1"
        }
    ], 
    "statusCode": "200", 
    "statusMsg": "OK", 
    "responseTimeStamp": "2012-06-20T08:36:24", 
}