All URIs are relative to https://api.opsgenie.com
Method | HTTP request | Description |
---|---|---|
change_policy_order | POST /v2/policies/{policyId}/change-order | Change Policy Order |
create_policy | POST /v2/policies | Create Policy |
delete_policy | DELETE /v2/policies/{policyId} | Delete Policy |
disable_policy | POST /v2/policies/{policyId}/disable | Disable Policy |
enable_policy | POST /v2/policies/{policyId}/enable | Enable Policy |
get_policy | GET /v2/policies/{policyId} | Get Policy |
list_alert_policies | GET /v2/policies/alert | List Alert Policies |
list_notification_policies | GET /v2/policies/notification | List Notification Policies |
update_policy | PUT /v2/policies/{policyId} | Update Policy |
SuccessResponse change_policy_order(policy_id, body, team_id=team_id)
Change Policy Order
Change execution order of the policy with given id
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# Configure API key authorization: GenieKey
configuration = swagger_client.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'
# create an instance of the API class
api_instance = swagger_client.PolicyApi(swagger_client.ApiClient(configuration))
policy_id = 'policy_id_example' # str | Id of the requested policy
body = swagger_client.ChangePolicyOrderPayload() # ChangePolicyOrderPayload | Change order payload
team_id = 'team_id_example' # str | TeamId of policy created if it belongs to a team (optional)
try:
# Change Policy Order
api_response = api_instance.change_policy_order(policy_id, body, team_id=team_id)
pprint(api_response)
except ApiException as e:
print("Exception when calling PolicyApi->change_policy_order: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
policy_id | str | Id of the requested policy | |
body | ChangePolicyOrderPayload | Change order payload | |
team_id | str | TeamId of policy created if it belongs to a team | [optional] |
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
CreatePolicyResponse create_policy(body, team_id=team_id)
Create Policy
Creates a new policy
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# Configure API key authorization: GenieKey
configuration = swagger_client.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'
# create an instance of the API class
api_instance = swagger_client.PolicyApi(swagger_client.ApiClient(configuration))
body = swagger_client.Policy() # Policy | Payload of created policy
team_id = NULL # object | TeamId of policy created if it belongs to a team (optional)
try:
# Create Policy
api_response = api_instance.create_policy(body, team_id=team_id)
pprint(api_response)
except ApiException as e:
print("Exception when calling PolicyApi->create_policy: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
body | Policy | Payload of created policy | |
team_id | object | TeamId of policy created if it belongs to a team | [optional] |
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
SuccessResponse delete_policy(policy_id, team_id=team_id)
Delete Policy
Delete policy with given id
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# Configure API key authorization: GenieKey
configuration = swagger_client.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'
# create an instance of the API class
api_instance = swagger_client.PolicyApi(swagger_client.ApiClient(configuration))
policy_id = 'policy_id_example' # str | Id of the requested policy
team_id = NULL # object | TeamId of policy created if it belongs to a team (optional)
try:
# Delete Policy
api_response = api_instance.delete_policy(policy_id, team_id=team_id)
pprint(api_response)
except ApiException as e:
print("Exception when calling PolicyApi->delete_policy: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
policy_id | str | Id of the requested policy | |
team_id | object | TeamId of policy created if it belongs to a team | [optional] |
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
SuccessResponse disable_policy(policy_id, team_id=team_id)
Disable Policy
Disable the policy with given id
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# Configure API key authorization: GenieKey
configuration = swagger_client.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'
# create an instance of the API class
api_instance = swagger_client.PolicyApi(swagger_client.ApiClient(configuration))
policy_id = 'policy_id_example' # str | Id of the requested policy
team_id = NULL # object | TeamId of policy created if it belongs to a team (optional)
try:
# Disable Policy
api_response = api_instance.disable_policy(policy_id, team_id=team_id)
pprint(api_response)
except ApiException as e:
print("Exception when calling PolicyApi->disable_policy: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
policy_id | str | Id of the requested policy | |
team_id | object | TeamId of policy created if it belongs to a team | [optional] |
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
SuccessResponse enable_policy(policy_id, team_id=team_id)
Enable Policy
Enable the policy with given id
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# Configure API key authorization: GenieKey
configuration = swagger_client.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'
# create an instance of the API class
api_instance = swagger_client.PolicyApi(swagger_client.ApiClient(configuration))
policy_id = 'policy_id_example' # str | Id of the requested policy
team_id = NULL # object | TeamId of policy created if it belongs to a team (optional)
try:
# Enable Policy
api_response = api_instance.enable_policy(policy_id, team_id=team_id)
pprint(api_response)
except ApiException as e:
print("Exception when calling PolicyApi->enable_policy: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
policy_id | str | Id of the requested policy | |
team_id | object | TeamId of policy created if it belongs to a team | [optional] |
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
GetPolicyResponse get_policy(policy_id, team_id=team_id)
Get Policy
Used to get details of a single policy with id
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# Configure API key authorization: GenieKey
configuration = swagger_client.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'
# create an instance of the API class
api_instance = swagger_client.PolicyApi(swagger_client.ApiClient(configuration))
policy_id = 'policy_id_example' # str | Id of the requested policy
team_id = NULL # object | TeamId of policy created if it belongs to a team (optional)
try:
# Get Policy
api_response = api_instance.get_policy(policy_id, team_id=team_id)
pprint(api_response)
except ApiException as e:
print("Exception when calling PolicyApi->get_policy: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
policy_id | str | Id of the requested policy | |
team_id | object | TeamId of policy created if it belongs to a team | [optional] |
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
ListPoliciesResponse list_alert_policies(team_id=team_id)
List Alert Policies
Returns the list of alert policies
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# Configure API key authorization: GenieKey
configuration = swagger_client.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'
# create an instance of the API class
api_instance = swagger_client.PolicyApi(swagger_client.ApiClient(configuration))
team_id = NULL # object | TeamId of policy created if it belongs to a team (optional)
try:
# List Alert Policies
api_response = api_instance.list_alert_policies(team_id=team_id)
pprint(api_response)
except ApiException as e:
print("Exception when calling PolicyApi->list_alert_policies: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
team_id | object | TeamId of policy created if it belongs to a team | [optional] |
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
ListPoliciesResponse list_notification_policies(team_id=team_id)
List Notification Policies
Returns the list of notification policies
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# Configure API key authorization: GenieKey
configuration = swagger_client.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'
# create an instance of the API class
api_instance = swagger_client.PolicyApi(swagger_client.ApiClient(configuration))
team_id = NULL # object | TeamId of policy created if it belongs to a team (optional)
try:
# List Notification Policies
api_response = api_instance.list_notification_policies(team_id=team_id)
pprint(api_response)
except ApiException as e:
print("Exception when calling PolicyApi->list_notification_policies: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
team_id | object | TeamId of policy created if it belongs to a team | [optional] |
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
SuccessResponse update_policy(policy_id, body, team_id=team_id)
Update Policy
Update alert policy with given id
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# Configure API key authorization: GenieKey
configuration = swagger_client.Configuration()
configuration.api_key['Authorization'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Authorization'] = 'Bearer'
# create an instance of the API class
api_instance = swagger_client.PolicyApi(swagger_client.ApiClient(configuration))
policy_id = 'policy_id_example' # str | Id of the requested policy
body = swagger_client.Policy() # Policy | Payload of updated policy
team_id = 'team_id_example' # str | TeamId of policy created if it belongs to a team (optional)
try:
# Update Policy
api_response = api_instance.update_policy(policy_id, body, team_id=team_id)
pprint(api_response)
except ApiException as e:
print("Exception when calling PolicyApi->update_policy: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
policy_id | str | Id of the requested policy | |
body | Policy | Payload of updated policy | |
team_id | str | TeamId of policy created if it belongs to a team | [optional] |
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]