Create Event With Ids
Description
Creates event with ids via the web service.
Function Signature:
def create_event_with_ids(ws_config: WebServiceConfig, device_id: int, device_serial: str, agent_type_id: int, event_type_id: int, server_event: int = 0, event_parameters: str = '', priority: int = 1, max_attempts: int = 0, expiration_epoch: int = 0) -> StandardResult:
Parameters
- ws_config (WebServiceConfig): Configuration for the web service connection.
- device_id (int): Device identifier.
- device_serial (str): Device serial number.
- agent_type_id (int): Agent type identifier.
- event_type_id (int): Event type identifier.
- server_event (int): Input value for
server_event. - event_parameters (str): Event parameters payload.
- priority (int): Priority value.
- max_attempts (int): Maximum attempt count.
- expiration_epoch (int): Expiration timestamp (Unix epoch seconds).
Returns
- StandardResult: A result object containing:
code: HTTP status code (200 for success,-1for exceptions).description: Response body or error message.
Example Usage
# Example usage
ws_config = WebServiceConfig(access_key="key", secret_key="secret", base_url="https://api.example.com/")
device_id = 1
device_serial = "example"
agent_type_id = 1
event_type_id = 1
server_event = 1
event_parameters = "example"
priority = 1
max_attempts = 1
expiration_epoch = 1
result = create_event_with_ids(ws_config, device_id, device_serial, agent_type_id, event_type_id, server_event, event_parameters, priority, max_attempts, expiration_epoch)
print(result)
Behavior
- Sends a signed request to the web service.
- On success, returns the computed value or result object.
Error Handling
- Exceptions set the result code to
-1and include an error message when implemented.