Skip to content

guruevi/medigate_api

Repository files navigation

medigate-api

Authentication

To use this API, create an API user from Admin Settings > User Management, and generate an API token. Use the token as an HTTP bearer token to authenticate and authorize your API requests.

To use the token, add an Authorization header such as:

Authorization: Bearer <your token here>

API Conventions

Pagination

The endpoints in this API are paginated. To iteratively obtain all data, make repeated requests with increasing offset starting at 0, and constant limit. For example, {\"offset\": 0, \"limit\": 100}, followed by {\"offset\": 100, \"limit\": 100}, {\"offset\": 200, \"limit\": 100}, until less than limit results are returned.

Filters

The endpoints in this API accept a filter_by argument to filter the results returned by the endpoint. Filters can be simple filters over a single field, or compound filters made up of other fields. For an example, look at the filter_by parameter of the endpoints below.

Simple Filters

Filters a single field of the result set. The operation may be one of:

operations Description value Type
in, not_in Checks for equality/inequality of any of the values Array of values
contains, not_contains Checks if the string in value is contained in the field string
in_subnet, not_in_subnet Checks if an IP field is in the subnet in value string or list of strings specifying an IP subnet in CIDR notation, such as \"192.168.1.0/24\"
is_null, is_not_null Checks if the field has null value None
greater, greater_or_equal, less, less_or_equal Compares with value a number or timestamp (ISO format) to compare with
after_seconds_ago, before_seconds_ago Compares the field with a timestamp relative to the current date and time number of seconds

Compound Filters

Simple filters can be combined with compound filters. The supported operations are:

  • not - Takes a single filter in operands, and negates the filter's condition
  • and, or - Take multiple filters in operands, and combines them with the appropriate boolean operation

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

  • API version: 1.0.0
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.PythonPydanticV1ClientCodegen

Requirements.

Python 3.7+

Installation & Usage

pip install

If the python package is hosted on a repository, you can install directly using:

pip install git+https://github.com/guruevi/medigate_api.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/guruevi/medigate_api.git)

Then import the package:

import medigate_api

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 medigate_api

Tests

Execute pytest to run the tests.

Getting Started

Please follow the installation procedure and then run the following:

import time
import medigate_api
from medigate_api.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.medigate.io
# See configuration.py for a list of all supported configuration parameters.
configuration = medigate_api.Configuration(
    host = "https://api.medigate.io"
)

# 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 Bearer authorization: CustomHTTPBearer
configuration = medigate_api.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)


# Enter a context with an instance of the API client
with medigate_api.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = medigate_api.AlertsApi(api_client)
    alert_id = 56 # int | Alert ID, as indicated in the `id` field of an alert
    get_alerted_devices_parameters = {offset=0, limit=100, fields=[id, alert_name, alert_type_name, alert_class, category, detected_time, updated_time, devices_count, unresolved_devices_count, medical_devices_count, iot_devices_count, it_devices_count, ot_devices_count, status, malicious_ip_tags_list]} # GetAlertedDevicesParameters | 

    try:
        # Get devices affected by an alert
        api_response = api_instance.get_alert_devices_api_v1_alerts_alert_id_devices_post(alert_id, get_alerted_devices_parameters)
        print("The response of AlertsApi->get_alert_devices_api_v1_alerts_alert_id_devices_post:\n")
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling AlertsApi->get_alert_devices_api_v1_alerts_alert_id_devices_post: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to https://api.medigate.io

Class Method HTTP request Description
AlertsApi get_alert_devices_api_v1_alerts_alert_id_devices_post POST /api/v1/alerts/{alert_id}/devices Get devices affected by an alert
AlertsApi get_alerts_api_v1_alerts_post POST /api/v1/alerts/ Get details of alerts
AlertsApi set_alert_resolution_api_v1_device_alert_status_set_post POST /api/v1/device-alert-status/set Set status for device alert relations
DeviceAlertPairsApi get_alert_devices_api_v1_device_alert_relations_post POST /api/v1/device_alert_relations/ Get device-alert relations
DeviceVulnerabilityPairsApi get_vulnerability_devices_api_v1_device_vulnerability_relations_post POST /api/v1/device_vulnerability_relations/ Get device-vulnerability relations
DeviceVulnerabilityPairsApi set_device_vulnerabilities_relevance_api_v1_device_vulnerability_relations_relevance_set_post POST /api/v1/device_vulnerability_relations/relevance/set Set device-vulnerability relevance
DevicesApi get_devices POST /api/v1/devices/ Get details of devices
DevicesApi set_custom_attribute POST /api/v1/custom-attributes/set Set the value of a device custom attribute
EventsApi get_ot_activity_events_api_v1_ot_activity_events_post POST /api/v1/ot_activity_events/ Get OT activity events
PassiveCollectionsApi get_servers_api_v1_server_interfaces_post POST /api/v1/server_interfaces/ Get server interfaces
PassiveCollectionsApi get_servers_api_v1_servers_post POST /api/v1/servers/ Get details of servers
UserActionsApi set_assignees_api_v1_user_actions_assignees_set_post POST /api/v1/user-actions/assignees/set Set Assignees
UserActionsApi set_labels_api_v1_user_actions_labels_set_post POST /api/v1/user-actions/labels/set Set Labels
UserActionsApi set_notes_api_v1_user_actions_notes_set_post POST /api/v1/user-actions/notes/set Set Notes
VulnerabilitiesApi get_vulnerabilities_api_v1_vulnerabilities_post POST /api/v1/vulnerabilities/ Get details of vulnerabilities
VulnerabilitiesApi get_vulnerable_devices_api_v1_vulnerabilities_vulnerability_id_devices_post POST /api/v1/vulnerabilities/{vulnerability_id}/devices Get devices affected by a vulnerability

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

CustomHTTPBearer

  • Type: Bearer authentication

Author

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages