Subject
  • 14 Nov 2024
  • 1 Minute to read
  • Dark
    Light

Subject

  • Dark
    Light

Article summary

This API facilitates sending "signals" as 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.

Argument

Description

Example

app_data_type string

(optional) arbitrary string - usually used when sending app_data to allow an application to distinguish between different data types.

system-override

app_data string

(optional) The content of the app_data is sent to applications associated with the input subject in the URL

This can be a JSON encoded string e.g.  '{"test-data": {"alpha": 1, "beta": 2}, "response": ["beta", 1000]}'

Responses

Status Code

Description

200

Successful completion.

4xx

Invalid data in post request A 404 error code will be returned if the subject is not configured in the gateway object - see https://support.cogniac.ai/v1/docs/gateways

API usage example:

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()


Was this article helpful?

What's Next