Skip to content

Latest commit

 

History

History
435 lines (305 loc) · 13.5 KB

ActionsApi.md

File metadata and controls

435 lines (305 loc) · 13.5 KB

groundlight_openapi_client.ActionsApi

All URIs are relative to https://api.groundlight.ai/device-api

Method HTTP request Description
create_rule POST /v1/actions/detector/{detector_id}/rules
delete_rule DELETE /v1/actions/rules/{id}
get_rule GET /v1/actions/rules/{id}
list_detector_rules GET /v1/actions/detector/{detector_id}/rules
list_rules GET /v1/actions/rules

create_rule

Rule create_rule(detector_id, rule_request)

Create a new rule for a detector

Example

  • Api Key Authentication (ApiToken):
import time
import groundlight_openapi_client
from groundlight_openapi_client.api import actions_api
from groundlight_openapi_client.model.rule import Rule
from groundlight_openapi_client.model.rule_request import RuleRequest
from pprint import pprint
# Defining the host is optional and defaults to https://api.groundlight.ai/device-api
# See configuration.py for a list of all supported configuration parameters.
configuration = groundlight_openapi_client.Configuration(
    host = "https://api.groundlight.ai/device-api"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: ApiToken
configuration.api_key['ApiToken'] = 'YOUR_API_KEY'

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['ApiToken'] = 'Bearer'

# Enter a context with an instance of the API client
with groundlight_openapi_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = actions_api.ActionsApi(api_client)
    detector_id = "detector_id_example" # str | 
    rule_request = RuleRequest(
        name="name_example",
        enabled=True,
        snooze_time_enabled=False,
        snooze_time_value=0,
        snooze_time_unit=None,
        human_review_required=False,
        condition=ConditionRequest(
            verb=VerbEnum("ANSWERED_CONSECUTIVELY"),
            parameters={
                "key": None,
            },
        ),
        action=None,
        webhook_action=[
            WebhookActionRequest(
                url="url_example",
                include_image=True,
                payload_template=None,
            ),
        ],
    ) # RuleRequest | 

    # example passing only required values which don't have defaults set
    try:
        api_response = api_instance.create_rule(detector_id, rule_request)
        pprint(api_response)
    except groundlight_openapi_client.ApiException as e:
        print("Exception when calling ActionsApi->create_rule: %s\n" % e)

Parameters

Name Type Description Notes
detector_id str
rule_request RuleRequest

Return type

Rule

Authorization

ApiToken

HTTP request headers

  • Content-Type: application/json, application/x-www-form-urlencoded, multipart/form-data
  • Accept: application/json

HTTP response details

Status code Description Response headers
201 -

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

delete_rule

delete_rule(id)

Delete a rule

Example

  • Api Key Authentication (ApiToken):
import time
import groundlight_openapi_client
from groundlight_openapi_client.api import actions_api
from pprint import pprint
# Defining the host is optional and defaults to https://api.groundlight.ai/device-api
# See configuration.py for a list of all supported configuration parameters.
configuration = groundlight_openapi_client.Configuration(
    host = "https://api.groundlight.ai/device-api"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: ApiToken
configuration.api_key['ApiToken'] = 'YOUR_API_KEY'

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['ApiToken'] = 'Bearer'

# Enter a context with an instance of the API client
with groundlight_openapi_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = actions_api.ActionsApi(api_client)
    id = 1 # int | 

    # example passing only required values which don't have defaults set
    try:
        api_instance.delete_rule(id)
    except groundlight_openapi_client.ApiException as e:
        print("Exception when calling ActionsApi->delete_rule: %s\n" % e)

Parameters

Name Type Description Notes
id int

Return type

void (empty response body)

Authorization

ApiToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

HTTP response details

Status code Description Response headers
204 No response body -

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

get_rule

Rule get_rule(id)

Retrieve a rule

Example

  • Api Key Authentication (ApiToken):
import time
import groundlight_openapi_client
from groundlight_openapi_client.api import actions_api
from groundlight_openapi_client.model.rule import Rule
from pprint import pprint
# Defining the host is optional and defaults to https://api.groundlight.ai/device-api
# See configuration.py for a list of all supported configuration parameters.
configuration = groundlight_openapi_client.Configuration(
    host = "https://api.groundlight.ai/device-api"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: ApiToken
configuration.api_key['ApiToken'] = 'YOUR_API_KEY'

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['ApiToken'] = 'Bearer'

# Enter a context with an instance of the API client
with groundlight_openapi_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = actions_api.ActionsApi(api_client)
    id = 1 # int | 

    # example passing only required values which don't have defaults set
    try:
        api_response = api_instance.get_rule(id)
        pprint(api_response)
    except groundlight_openapi_client.ApiException as e:
        print("Exception when calling ActionsApi->get_rule: %s\n" % e)

Parameters

Name Type Description Notes
id int

Return type

Rule

Authorization

ApiToken

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 -

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

list_detector_rules

PaginatedRuleList list_detector_rules(detector_id)

List all rules for a detector

Example

  • Api Key Authentication (ApiToken):
import time
import groundlight_openapi_client
from groundlight_openapi_client.api import actions_api
from groundlight_openapi_client.model.paginated_rule_list import PaginatedRuleList
from pprint import pprint
# Defining the host is optional and defaults to https://api.groundlight.ai/device-api
# See configuration.py for a list of all supported configuration parameters.
configuration = groundlight_openapi_client.Configuration(
    host = "https://api.groundlight.ai/device-api"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: ApiToken
configuration.api_key['ApiToken'] = 'YOUR_API_KEY'

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['ApiToken'] = 'Bearer'

# Enter a context with an instance of the API client
with groundlight_openapi_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = actions_api.ActionsApi(api_client)
    detector_id = "detector_id_example" # str | 
    page = 1 # int | A page number within the paginated result set. (optional)
    page_size = 1 # int | Number of results to return per page. (optional)

    # example passing only required values which don't have defaults set
    try:
        api_response = api_instance.list_detector_rules(detector_id)
        pprint(api_response)
    except groundlight_openapi_client.ApiException as e:
        print("Exception when calling ActionsApi->list_detector_rules: %s\n" % e)

    # example passing only required values which don't have defaults set
    # and optional values
    try:
        api_response = api_instance.list_detector_rules(detector_id, page=page, page_size=page_size)
        pprint(api_response)
    except groundlight_openapi_client.ApiException as e:
        print("Exception when calling ActionsApi->list_detector_rules: %s\n" % e)

Parameters

Name Type Description Notes
detector_id str
page int A page number within the paginated result set. [optional]
page_size int Number of results to return per page. [optional]

Return type

PaginatedRuleList

Authorization

ApiToken

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 -

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

list_rules

PaginatedRuleList list_rules()

Lists all rules over all detectors owned by the requester.

Example

  • Api Key Authentication (ApiToken):
import time
import groundlight_openapi_client
from groundlight_openapi_client.api import actions_api
from groundlight_openapi_client.model.paginated_rule_list import PaginatedRuleList
from pprint import pprint
# Defining the host is optional and defaults to https://api.groundlight.ai/device-api
# See configuration.py for a list of all supported configuration parameters.
configuration = groundlight_openapi_client.Configuration(
    host = "https://api.groundlight.ai/device-api"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: ApiToken
configuration.api_key['ApiToken'] = 'YOUR_API_KEY'

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['ApiToken'] = 'Bearer'

# Enter a context with an instance of the API client
with groundlight_openapi_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = actions_api.ActionsApi(api_client)
    page = 1 # int | A page number within the paginated result set. (optional)
    page_size = 1 # int | Number of results to return per page. (optional)

    # example passing only required values which don't have defaults set
    # and optional values
    try:
        api_response = api_instance.list_rules(page=page, page_size=page_size)
        pprint(api_response)
    except groundlight_openapi_client.ApiException as e:
        print("Exception when calling ActionsApi->list_rules: %s\n" % e)

Parameters

Name Type Description Notes
page int A page number within the paginated result set. [optional]
page_size int Number of results to return per page. [optional]

Return type

PaginatedRuleList

Authorization

ApiToken

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 -

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