Skip to content

Latest commit

 

History

History
515 lines (367 loc) · 16.8 KB

UserApi.md

File metadata and controls

515 lines (367 loc) · 16.8 KB

swagger_client.UserApi

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

Method HTTP request Description
create_user POST /v2/users Create User
delete_user DELETE /v2/users/{identifier} Delete User
get_user GET /v2/users/{identifier} Get User
list_user_escalations GET /v2/users/{identifier}/escalations List User Escalations
list_user_forwarding_rules GET /v2/users/{identifier}/forwarding-rules List User Forwarding Rules
list_user_schedules GET /v2/users/{identifier}/schedules List User Schedules
list_user_teams GET /v2/users/{identifier}/teams List User Teams
list_users GET /v2/users List users
update_user PATCH /v2/users/{identifier} Update User (Partial)

create_user

SuccessResponse create_user(body)

Create User

Creates a user with the given payload

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.UserApi(swagger_client.ApiClient(configuration))
body = swagger_client.CreateUserPayload() # CreateUserPayload | Request payload of the user object

try:
    # Create User
    api_response = api_instance.create_user(body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling UserApi->create_user: %s\n" % e)

Parameters

Name Type Description Notes
body CreateUserPayload Request payload of the user object

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_user

SuccessResponse delete_user(identifier)

Delete User

Delete user with the given identifier

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

try:
    # Delete User
    api_response = api_instance.delete_user(identifier)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling UserApi->delete_user: %s\n" % e)

Parameters

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

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_user

GetUserResponse get_user(identifier, expand=expand)

Get User

Get user for the given identifier

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.UserApi(swagger_client.ApiClient(configuration))
identifier = 'identifier_example' # str | Identifier of the user to be searched
expand = ['expand_example'] # list[str] | Comma separated list of strings to create a more detailed response. The only expandable field for user api is 'contact' (optional)

try:
    # Get User
    api_response = api_instance.get_user(identifier, expand=expand)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling UserApi->get_user: %s\n" % e)

Parameters

Name Type Description Notes
identifier str Identifier of the user to be searched
expand list[str] Comma separated list of strings to create a more detailed response. The only expandable field for user api is 'contact' [optional]

Return type

GetUserResponse

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_user_escalations

ListUserEscalationsResponse list_user_escalations(identifier)

List User Escalations

List escalations of the user for the given identifier

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

try:
    # List User Escalations
    api_response = api_instance.list_user_escalations(identifier)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling UserApi->list_user_escalations: %s\n" % e)

Parameters

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

Return type

ListUserEscalationsResponse

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_user_forwarding_rules

ListUserForwardingRulesResponse list_user_forwarding_rules(identifier)

List User Forwarding Rules

List user forwarding rules for the given user identifier

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

try:
    # List User Forwarding Rules
    api_response = api_instance.list_user_forwarding_rules(identifier)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling UserApi->list_user_forwarding_rules: %s\n" % e)

Parameters

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

Return type

ListUserForwardingRulesResponse

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_user_schedules

ListUserSchedulesResponse list_user_schedules(identifier)

List User Schedules

List schedules of the user for the given identifier

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

try:
    # List User Schedules
    api_response = api_instance.list_user_schedules(identifier)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling UserApi->list_user_schedules: %s\n" % e)

Parameters

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

Return type

ListUserSchedulesResponse

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_user_teams

ListUserTeamsResponse list_user_teams(identifier)

List User Teams

List user teams for the given user identifier

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

try:
    # List User Teams
    api_response = api_instance.list_user_teams(identifier)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling UserApi->list_user_teams: %s\n" % e)

Parameters

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

Return type

ListUserTeamsResponse

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_users

ListUsersResponse list_users(limit=limit, offset=offset, sort_field=sort_field, order=order, query=query)

List users

List users with given parameters

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.UserApi(swagger_client.ApiClient(configuration))
limit = 100 # int | Number of users to retrieve (optional) (default to 100)
offset = 0 # int | Number of users to skip from start (optional) (default to 0)
sort_field = 'sort_field_example' # str | Field to use in sorting. Should be one of 'username', 'fullName' and 'insertedAt' (optional)
order = 'asc' # str | Direction of sorting. Should be one of 'asc' or 'desc' (optional) (default to asc)
query = 'query_example' # str | Field:value combinations with most of user fields to make more advanced searches. Possible fields are username, fullName, blocked, verified, role, locale, timeZone, userAddress and createdAt (optional)

try:
    # List users
    api_response = api_instance.list_users(limit=limit, offset=offset, sort_field=sort_field, order=order, query=query)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling UserApi->list_users: %s\n" % e)

Parameters

Name Type Description Notes
limit int Number of users to retrieve [optional] [default to 100]
offset int Number of users to skip from start [optional] [default to 0]
sort_field str Field to use in sorting. Should be one of 'username', 'fullName' and 'insertedAt' [optional]
order str Direction of sorting. Should be one of 'asc' or 'desc' [optional] [default to asc]
query str Field:value combinations with most of user fields to make more advanced searches. Possible fields are username, fullName, blocked, verified, role, locale, timeZone, userAddress and createdAt [optional]

Return type

ListUsersResponse

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_user

SuccessResponse update_user(identifier, body=body)

Update User (Partial)

Update user with the given identifier

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.UserApi(swagger_client.ApiClient(configuration))
identifier = 'identifier_example' # str | Identifier of the user to be searched
body = swagger_client.UpdateUserPayload() # UpdateUserPayload | Request payload of the user object (optional)

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

Parameters

Name Type Description Notes
identifier str Identifier of the user to be searched
body UpdateUserPayload Request payload of the user object [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]