Skip to content

opsgenie/opsgenie-python-sdk

Repository files navigation

Python SDK for Opsgenie REST API

This Python package is automatically generated by the OpenAPI Generator project:

  • API version: 2.0.0
  • Package version: 2.1.5
  • Build package: com.atlassian.opsgenie.codegen.geniepy.GeniepyGenerator

For more information, please visit https://www.opsgenie.com/contact-us

Requirements.

Python 2.7 and 3.4+

Installation & Usage

pip install

If the python package is hosted on Github, you can install directly from Github

pip install opsgenie-sdk

(you may need to run pip with root permission: sudo pip install opsgenie-sdk)

Then import the package:

import opsgenie_sdk 

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import opsgenie_sdk

Getting Started

Please follow the installation procedure and then run the following:

from __future__ import print_function
import time
import opsgenie_sdk
from opsgenie_sdk.rest import ApiException
from pprint import pprint

configuration = opsgenie_sdk.Configuration()
# Configure API key authorization: GenieKey
configuration.api_key['Authorization'] = 'YOUR_API_KEY'

# create an instance of the API class
api_instance = opsgenie_sdk.AccountApi(opsgenie_sdk.ApiClient(configuration))

try:
    # Get Account Info
    api_response = api_instance.get_info()
    pprint(api_response)
except ApiException as e:
    print("Exception when calling AccountApi->get_info: %s\n" % e)

Note: if you have an european account please set attribute 'host'

configuration.host = 'https://api.eu.opsgenie.com'

Documentation for API Endpoints

All URIs are relative to https://api.opsgenie.com

Class Method HTTP request Description
AccountApi get_info GET /v2/account Get Account Info
AlertApi acknowledge_alert POST /v2/alerts/{identifier}/acknowledge Acknowledge Alert
AlertApi add_attachment POST /v2/alerts/{identifier}/attachments Add Alert Attachment
AlertApi add_details POST /v2/alerts/{identifier}/details Add Details
AlertApi add_note POST /v2/alerts/{identifier}/notes Add Note
AlertApi add_responder POST /v2/alerts/{identifier}/responders Add Responder
AlertApi add_tags POST /v2/alerts/{identifier}/tags Add Tags
AlertApi add_team POST /v2/alerts/{identifier}/teams Add Team
AlertApi assign_alert POST /v2/alerts/{identifier}/assign Assign Alert
AlertApi close_alert POST /v2/alerts/{identifier}/close Close Alert
AlertApi count_alerts GET /v2/alerts/count Count Alerts
AlertApi create_alert POST /v2/alerts Create Alert
AlertApi create_saved_searches POST /v2/alerts/saved-searches Create Saved Search
AlertApi delete_alert DELETE /v2/alerts/{identifier} Delete Alert
AlertApi delete_saved_search DELETE /v2/alerts/saved-searches/{identifier} Delete Saved Search
AlertApi escalate_alert POST /v2/alerts/{identifier}/escalate Escalate Alert
AlertApi execute_custom_alert_action POST /v2/alerts/{identifier}/actions/{actionName} Custom Alert Action
AlertApi get_alert GET /v2/alerts/{identifier} Get Alert
AlertApi get_attachment GET /v2/alerts/{identifier}/attachments/{attachmentId} Get Alert Attachment
AlertApi get_request_status GET /v2/alerts/requests/{requestId} Get Request Status of Alert
AlertApi get_saved_search GET /v2/alerts/saved-searches/{identifier} Get Saved Search
AlertApi list_alerts GET /v2/alerts List Alerts
AlertApi list_attachments GET /v2/alerts/{identifier}/attachments List Alert Attachments
AlertApi list_logs GET /v2/alerts/{identifier}/logs List Alert Logs
AlertApi list_notes GET /v2/alerts/{identifier}/notes List Alert Notes
AlertApi list_recipients GET /v2/alerts/{identifier}/recipients List Alert Recipients
AlertApi list_saved_searches GET /v2/alerts/saved-searches Lists Saved Searches
AlertApi remove_attachment DELETE /v2/alerts/{identifier}/attachments/{attachmentId} Remove Alert Attachment
AlertApi remove_details DELETE /v2/alerts/{identifier}/details Remove Details
AlertApi remove_tags DELETE /v2/alerts/{identifier}/tags Remove Tags
AlertApi snooze_alert POST /v2/alerts/{identifier}/snooze Snooze Alert
AlertApi un_acknowledge_alert POST /v2/alerts/{identifier}/unacknowledge UnAcknowledge Alert
AlertApi update_alert_description PUT /v2/alerts/{identifier}/description Update Alert Description
AlertApi update_alert_message PUT /v2/alerts/{identifier}/message Update Alert Message
AlertApi update_alert_priority PUT /v2/alerts/{identifier}/priority Update Alert Priority
AlertApi update_saved_search PATCH /v2/alerts/saved-searches/{identifier} Update Saved Search
HeartbeatApi create_heartbeat POST /v2/heartbeats Create Heartbeat
HeartbeatApi delete_heartbeat DELETE /v2/heartbeats/{name} Delete Heartbeat
HeartbeatApi disable_heartbeat POST /v2/heartbeats/{name}/disable Disable Heartbeat
HeartbeatApi enable_heartbeat POST /v2/heartbeats/{name}/enable Enable Heartbeat
HeartbeatApi get_heartbeat GET /v2/heartbeats/{name} Get Heartbeat
HeartbeatApi list_heart_beats GET /v2/heartbeats List Heartbeats
HeartbeatApi ping GET /v2/heartbeats/{name}/ping Ping Heartbeat
HeartbeatApi update_heartbeat PATCH /v2/heartbeats/{name} Update Heartbeat (Partial)
IncidentApi close_incident POST /v1/incidents/{identifier}/close Close Incident
IncidentApi create_incident POST /v1/incidents/create Create Incident
IncidentApi delete_incident DELETE /v1/incidents/{identifier} Delete Incident
IncidentApi get_incident GET /v1/incidents/{identifier} Get Incident
IncidentApi get_incident_request_status GET /v1/incidents/requests/{requestId} Get Request Status of Incident
IncidentApi list_incidents GET /v1/incidents/ List incidents

Documentation For Models

Documentation For Authorization

GenieKey

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header

Author

[email protected]