Skip to content

Latest commit

 

History

History
316 lines (245 loc) · 13.9 KB

EventsApi.md

File metadata and controls

316 lines (245 loc) · 13.9 KB

waylay.services.data.EventsApi

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

Method HTTP request Description
post_series POST /data/v1/events Post Events
post_series_for_resource POST /data/v1/events/{resourceId} Post Events For Resource
remove DELETE /data/v1/{resourceId} Remove Data
stream_events GET /data/v1/events/{resourceId} Stream Events For Resource

post_series

post_series( query: PostSeriesQuery, headers ) -> PublishEventResponse

Post Events

Pushes events to broker.

Example

from pprint import pprint

# Import the waylay-client from the waylay-sdk-core package
from waylay.sdk.client import WaylayClient
from waylay.sdk.api.api_exceptions import ApiError

# Intialize a waylay client instance
waylay_client = WaylayClient.from_profile()

# Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-data-types` is installed
from waylay.services.data.models.post_series_request import PostSeriesRequest
from waylay.services.data.models.publish_event_response import PublishEventResponse
try:
    # Post Events
    # calls `POST /data/v1/events`
    api_response = await waylay_client.data.events.post_series(
        # query parameters:
        query = {
        },
        # json data: use a generated model or a json-serializable python data structure (dict, list)
        json = waylay.services.data.PostSeriesRequest() # PostSeriesRequest |  (optional)
    )
    print("The response of data.events.post_series:\n")
    pprint(api_response)
except ApiError as e:
    print("Exception when calling data.events.post_series: %s\n" % e)

Endpoint

POST /data/v1/events

Parameters

Name Type API binding Description Notes
json PostSeriesRequest json request body [optional]
query QueryParamTypes | None URL query parameter
query['forward'] (dict)
query.forward (Query)
bool query parameter "forward" If payload is a single event, Events are forwarded to the Rule Engine unless `forward` is explicitly set to `false`. If payload has multiple events and each event is for a distinct resource, all Events are forwarded to the Rule Engine unless `forward` is explicitly set to `false` If payload has multiple events and there are multiple events for the same resource, an error will be returned if `forward` is explicitly set to `true`. [optional] [default True]
query['store'] (dict)
query.store (Query)
bool query parameter "store" Unless explicitly set to `false`, Events are stored into message cache, and their scalar attributes stored in the time series database. [optional] [default True]
query['ttl'] (dict)
query.ttl (Query)
TTLDuration query parameter "ttl" Specifies how long data persists in both the message cache and time series database. [optional]
headers HeaderTypes request headers

Return type

Selected path param Raw response param Return Type Description Links
Literal[""] (default) False (default) PublishEventResponse PublishEventResponse
str False (default) Any If any other string value for the selected path is provided, the exact type of the response will only be known at runtime.
/ True Response The raw http response object.

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Event(s) Published -
400 Error Response -

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

post_series_for_resource

post_series_for_resource( resource_id: str, query: PostSeriesForResourceQuery, headers ) -> PublishResourceEventResponse

Post Events For Resource

Pushes events for a given resource to broker.

Example

from pprint import pprint

# Import the waylay-client from the waylay-sdk-core package
from waylay.sdk.client import WaylayClient
from waylay.sdk.api.api_exceptions import ApiError

# Intialize a waylay client instance
waylay_client = WaylayClient.from_profile()

# Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-data-types` is installed
from waylay.services.data.models.post_series_for_resource_request import PostSeriesForResourceRequest
from waylay.services.data.models.publish_resource_event_response import PublishResourceEventResponse
try:
    # Post Events For Resource
    # calls `POST /data/v1/events/{resourceId}`
    api_response = await waylay_client.data.events.post_series_for_resource(
        'resource_id_example', # resource_id | path param "resourceId"
        # query parameters:
        query = {
        },
        # json data: use a generated model or a json-serializable python data structure (dict, list)
        json = waylay.services.data.PostSeriesForResourceRequest() # PostSeriesForResourceRequest |  (optional)
    )
    print("The response of data.events.post_series_for_resource:\n")
    pprint(api_response)
except ApiError as e:
    print("Exception when calling data.events.post_series_for_resource: %s\n" % e)

Endpoint

POST /data/v1/events/{resourceId}

Parameters

Name Type API binding Description Notes
resource_id str path parameter "resourceId" Uniquely identifies a resource.
json PostSeriesForResourceRequest json request body [optional]
query QueryParamTypes | None URL query parameter
query['forward'] (dict)
query.forward (Query)
bool query parameter "forward" If payload is a single event, Events are forwarded to the Rule Engine unless `forward` is explicitly set to `false`. If payload has multiple events, this parameter is ignored and Events will only be stored into message cache and their scalar attributes in the timeseries database. [optional] [default True]
query['store'] (dict)
query.store (Query)
bool query parameter "store" Unless explicitly set to `false`, Events are stored into message cache, and their scalar attributes stored in the time series database. [optional] [default True]
query['ttl'] (dict)
query.ttl (Query)
TTLDuration query parameter "ttl" Specifies how long data persists in both the message cache and time series database. [optional]
headers HeaderTypes request headers

Return type

Selected path param Raw response param Return Type Description Links
Literal[""] (default) False (default) PublishResourceEventResponse PublishResourceEventResponse
str False (default) Any If any other string value for the selected path is provided, the exact type of the response will only be known at runtime.
/ True Response The raw http response object.

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Event(s) Published -
400 Error Response -

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

remove

remove( resource_id: str, query: RemoveQuery, headers ) -> DeleteMessages200Response

Remove Data

Removes all data for a resource.

Example

from pprint import pprint

# Import the waylay-client from the waylay-sdk-core package
from waylay.sdk.client import WaylayClient
from waylay.sdk.api.api_exceptions import ApiError

# Intialize a waylay client instance
waylay_client = WaylayClient.from_profile()

# Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-data-types` is installed
from waylay.services.data.models.delete_messages200_response import DeleteMessages200Response
try:
    # Remove Data
    # calls `DELETE /data/v1/{resourceId}`
    api_response = await waylay_client.data.events.remove(
        'resource_id_example', # resource_id | path param "resourceId"
        # query parameters:
        query = {
        },
    )
    print("The response of data.events.remove:\n")
    pprint(api_response)
except ApiError as e:
    print("Exception when calling data.events.remove: %s\n" % e)

Endpoint

DELETE /data/v1/{resourceId}

Parameters

Name Type API binding Description Notes
resource_id str path parameter "resourceId" Uniquely identifies a resource.
query QueryParamTypes | None URL query parameter
query['from'] (dict)
query.var_from (Query)
DeleteSeriesFromParameter query parameter "from" Specifies the lower bound of the time period [optional]
query['until'] (dict)
query.until (Query)
DeleteSeriesFromParameter query parameter "until" Specifies the upper bound of the time period [optional]
query['onlytimeseries'] (dict)
query.onlytimeseries (Query)
bool query parameter "onlytimeseries" if set to `true` will only delete timeseries data [optional] [default False]
headers HeaderTypes request headers

Return type

Selected path param Raw response param Return Type Description Links
Literal[""] (default) False (default) DeleteMessages200Response DeleteMessages200Response
str False (default) Any If any other string value for the selected path is provided, the exact type of the response will only be known at runtime.
/ True Response The raw http response object.

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Successful Response -
400 Error Response -

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

stream_events

stream_events( resource_id: str, headers ) -> AsyncIterator[TimestampedResourceEvent]

Stream Events For Resource

Opens a data stream for the Events of the given Resource.

Example

from pprint import pprint

# Import the waylay-client from the waylay-sdk-core package
from waylay.sdk.client import WaylayClient
from waylay.sdk.api.api_exceptions import ApiError

# Intialize a waylay client instance
waylay_client = WaylayClient.from_profile()

# Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-data-types` is installed
from waylay.services.data.models.timestamped_resource_event import TimestampedResourceEvent
try:
    # Stream Events For Resource
    # calls `GET /data/v1/events/{resourceId}`
    api_response = await waylay_client.data.events.stream_events(
        'resource_id_example', # resource_id | path param "resourceId"
    )
    print("The response of data.events.stream_events:\n")
    pprint(api_response)
except ApiError as e:
    print("Exception when calling data.events.stream_events: %s\n" % e)

Endpoint

GET /data/v1/events/{resourceId}

Parameters

Name Type API binding Description Notes
resource_id str path parameter "resourceId" Uniquely identifies a resource.
headers HeaderTypes request headers

Return type

Selected path param Raw response param Return Type Description Links
Literal[""] (default) False (default) AsyncIterator[TimestampedResourceEvent] TimestampedResourceEvent
str False (default) Any If any other string value for the selected path is provided, the exact type of the response will only be known at runtime.
/ True Response The raw http response object.

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/x-ndjson, text/event-stream, default

HTTP response details

Status code Description Response headers
200 Event Stream -
406 Requested Content Type Not Acceptable -

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