Subject

send an assertion to a subject with optional data

This API facilitates sending "signals" in the form of assertions to applications associated with an input subject.

POST /1/subject/{subject_uid}
HOST: http://<gateway ip address or hostname>:8000

Additional arguments can be sent accompanying the subject_uid. The subject_uid must be configured in the EF "Input Subjects" section.

ArgumentDescriptionExample
app_data_type
string
(optional) arbitrary string - usually used when sending app_data to allow an application to distinguish between different types of data.system-override
app_data
string
(optional) The content of the app_data is sent to applications associated with the input subject in the URLThis can be a json encoded string e.g.
'{"test-data": {"alpha": 1, "beta": 2}, "response": ["beta", 1000]}'

Responses

Status CodeDescription
200Successful completion.
4xxInvalid data in post request
A 404 error code will be returned if the subject is not configured in the gateway object - see https://cogniac.readme.io/docs/gateways

API usage exmple:

import requests
import json

API_VERSION = 1
GATEWAY_HOST_IP="10.1.20.100"
URL_PREFIX = 'http://%s:8000/%d/' % (GATEWAY_HOST_IP, API_VERSION)
TOUT_SECS = 20
SUBJECT_UID = "widget_responder_6op"

msg_data = json.dumps{'test-data': {'alpha': 1}, 'response': ['beta', 1000]}
data = {'app_data_type': 'override', 'app_data': msg_data}

resp = requests.post(URL_PREFIX + 'subject/%s' % SUBJECT_UID, data=data, timeout=TOUT_SECS)

if resp.status_code == 200:
    detections = resp.json()