- 22 Dec 2023
- 2 Minutes to read
- Print
- DarkLight
Applications - Events
- Updated on 22 Dec 2023
- 2 Minutes to read
- Print
- DarkLight
The Application Events endpoint returns records of changes that have occurred related to the given application.
Application Event Object
Field | Example | Definition |
---|---|---|
application_id | "di71rG94" | The ID of the requested application. |
event_id | "tHAV32G" | The unique ID of the given event record. |
type | "application_replay" | The type of event. See below for supported application event types. |
message | "test_user@cogniac.co replayed 10 subject-media from subject cat in application di71rG94. 45 consensus subject-media skipped." | A brief message describing the event. |
event_data | "{"user_id": "test_user@cogniac.co", "replayed": 10, "skipped": 45, "limit": 10.0, "validation_only": false, "force_feedback": true, "subject_uid": "cat", "replay_order": "random", "probability_upper": 1.0, "probability_lower": 0.0}" | Raw data for the event as a JSON-encoded string. |
created_at | 1234567890 | The timestamp of the event. |
Application Event Types
The following application event types are tracked and returned:
application_config_change - An application has been created, updated, or deleted.
model_trained - A new model was trained for this application.
model_released - A new, best-performing model has been released for this application.
application_replay - A user has replayed media through this application.
application_feedback_purged - A user has purged the pending feedback requests for this application.
Retrieving Application Events
The application events endpoint accepts various query filters:
Argument | Example | Description |
---|---|---|
start | 1234567890 | (optional) |
end | 1234567890 | (optional) |
event_types | ["application_config_change", "application_model_released"] | (optional) |
limit | 10 | (optional) |
GET /1/applications/{app_id}/events
Host: https://api.cogniac.io
Example: Retrieve Application Events
curl -X GET https://api.cogniac.io/1/applications/di71rG94/events?limit=10&reverse=true \
-H "Authorization: Bearer abcdefg.hijklmnop.qrstuvwxyz" \
import requests
import json
my_headers = {"Authorization":"Bearer abcdefg.hijklmnop.qrstuvwxyz"}
resp = requests.get("https://api.cogniac.io/1/applications/di71rG94/events?limit=10&reverse=true",
headers=my_headers)
if resp.status_code == 200:
formatted_json = json.dumps(resp.json(), indent=2)
print(formatted_json)
else:
print(f"Error: {resp.status_code}")
print(resp.content)
{
"data": [
{
"application_id": "di71rG94",
"created_at": 1514933657.972397,
"event_data": "...",
"event_id": "ey3y05ES",
"message": "other_user@cogniac.co\nchanged active from true to false",
"type": "application_config_change"
},
{
"application_id": "di71rG94",
"created_at": 1514929197.486502,
"event_data": "{\"user_id\": \"test_user@cogniac.co\", \"replayed\": 10, \"skipped\": 45, \"limit\": 10.0, \"validation_only\": false, \"force_feedback\": true, \"subject_uid\": \"cat\", \"replay_order\": \"random\", \"probability_upper\": 1.0, \"probability_lower\": 0.0}",
"event_id": "88Oh2jGn",
"message": "test_user@cogniac.co replayed 10 subject-media from subject cat in application di71rG94. 45 consensus subject-media skipped.",
"type": "application_replay"
},
{
"application_id": "di71rG94",
"created_at": 1514927486.350218,
"event_data": "{\"model_uri\": \"s3://cogniac-models/InitialModel_di71rG94_Gnno00.tgz\", \"model_id\": \"InitialModel_di71rG94_Gnno00.tgz\", \"timestamp\": 1514927486.1633, \"validation_data_size\": 0, \"app_id\": \"di71rG94\", \"validation_media_focus_size\": 0, \"output_subjects\": [\"cat\"], \"type\": \"detection_fullframe\", \"release_metrics\": \"best_F1\"}",
"event_id": "xlYTLS4B",
"message": "model_id InitialModel_di71rG94_Gnno00.tgz, validation_media_focus_size 0",
"type": "model_release"
},
{
"application_id": "di71rG94",
"created_at": 1514927479.842088,
"event_data": "...",
"event_id": "WaOXPMRX",
"message": "test_user@cogniac.co\nchanged active from false to true",
"type": "application_config_change"
},
...
]
}