Skip to content

Latest commit

 

History

History
407 lines (291 loc) · 12.7 KB

ContactApi.md

File metadata and controls

407 lines (291 loc) · 12.7 KB

swagger_client.ContactApi

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

Method HTTP request Description
create_contact POST /v2/users/{identifier}/contacts Create Contact
delete_contact DELETE /v2/users/{identifier}/contacts/{contactId} Delete Contact
disable_contact POST /v2/users/{identifier}/contacts/{contactId}/disable Disable Contact
enable_contact POST /v2/users/{identifier}/contacts/{contactId}/enable Enable Contact
get_contact GET /v2/users/{identifier}/contacts/{contactId} Get Contact
list_contacts GET /v2/users/{identifier}/contacts List Contacts
update_contact PATCH /v2/users/{identifier}/contacts/{contactId} Update Contact (Partial)

create_contact

SuccessResponse create_contact(identifier, body=body)

Create Contact

Creates a new contact

Example

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.ContactApi(swagger_client.ApiClient(configuration))
identifier = 'identifier_example' # str | Identifier of the user to be searched
body = swagger_client.CreateContactPayload() # CreateContactPayload | Request payload of creating contact action (optional)

try:
    # Create Contact
    api_response = api_instance.create_contact(identifier, body=body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ContactApi->create_contact: %s\n" % e)

Parameters

Name Type Description Notes
identifier str Identifier of the user to be searched
body CreateContactPayload Request payload of creating contact action [optional]

Return type

SuccessResponse

Authorization

GenieKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

delete_contact

SuccessResponse delete_contact(identifier, contact_id)

Delete Contact

Delete contact using contact id

Example

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.ContactApi(swagger_client.ApiClient(configuration))
identifier = 'identifier_example' # str | Identifier of the user to be searched
contact_id = 'contact_id_example' # str | Id of the contact

try:
    # Delete Contact
    api_response = api_instance.delete_contact(identifier, contact_id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ContactApi->delete_contact: %s\n" % e)

Parameters

Name Type Description Notes
identifier str Identifier of the user to be searched
contact_id str Id of the contact

Return type

SuccessResponse

Authorization

GenieKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

disable_contact

SuccessResponse disable_contact(identifier, contact_id)

Disable Contact

Disable the contact of the user

Example

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.ContactApi(swagger_client.ApiClient(configuration))
identifier = 'identifier_example' # str | Identifier of the user to be searched
contact_id = 'contact_id_example' # str | Id of the contact

try:
    # Disable Contact
    api_response = api_instance.disable_contact(identifier, contact_id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ContactApi->disable_contact: %s\n" % e)

Parameters

Name Type Description Notes
identifier str Identifier of the user to be searched
contact_id str Id of the contact

Return type

SuccessResponse

Authorization

GenieKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

enable_contact

SuccessResponse enable_contact(identifier, contact_id)

Enable Contact

Enable the contact of the user

Example

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.ContactApi(swagger_client.ApiClient(configuration))
identifier = 'identifier_example' # str | Identifier of the user to be searched
contact_id = 'contact_id_example' # str | Id of the contact

try:
    # Enable Contact
    api_response = api_instance.enable_contact(identifier, contact_id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ContactApi->enable_contact: %s\n" % e)

Parameters

Name Type Description Notes
identifier str Identifier of the user to be searched
contact_id str Id of the contact

Return type

SuccessResponse

Authorization

GenieKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_contact

GetContactResponse get_contact(identifier, contact_id)

Get Contact

Returns contact with given id

Example

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.ContactApi(swagger_client.ApiClient(configuration))
identifier = 'identifier_example' # str | Identifier of the user to be searched
contact_id = 'contact_id_example' # str | Id of the contact

try:
    # Get Contact
    api_response = api_instance.get_contact(identifier, contact_id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ContactApi->get_contact: %s\n" % e)

Parameters

Name Type Description Notes
identifier str Identifier of the user to be searched
contact_id str Id of the contact

Return type

GetContactResponse

Authorization

GenieKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

list_contacts

ListContactsResponse list_contacts(identifier)

List Contacts

Returns list of contacts

Example

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.ContactApi(swagger_client.ApiClient(configuration))
identifier = 'identifier_example' # str | Identifier of the user to be searched

try:
    # List Contacts
    api_response = api_instance.list_contacts(identifier)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ContactApi->list_contacts: %s\n" % e)

Parameters

Name Type Description Notes
identifier str Identifier of the user to be searched

Return type

ListContactsResponse

Authorization

GenieKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

update_contact

SuccessResponse update_contact(identifier, contact_id, body=body)

Update Contact (Partial)

Update contact of the user

Example

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.ContactApi(swagger_client.ApiClient(configuration))
identifier = 'identifier_example' # str | Identifier of the user to be searched
contact_id = 'contact_id_example' # str | Id of the contact
body = swagger_client.UpdateContactPayload() # UpdateContactPayload | Request payload of update contact action (optional)

try:
    # Update Contact (Partial)
    api_response = api_instance.update_contact(identifier, contact_id, body=body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ContactApi->update_contact: %s\n" % e)

Parameters

Name Type Description Notes
identifier str Identifier of the user to be searched
contact_id str Id of the contact
body UpdateContactPayload Request payload of update contact action [optional]

Return type

SuccessResponse

Authorization

GenieKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]