Tenants - Subjects
The Tenant's subject search endpoint allows users to search subjects available to the authorized tenant.
The type of search performed is determined by the query arguments passed:
Argument | Example | Definition |
---|---|---|
ids string | "cat_123,dog_123" | (optional) A comma-delimited list of subject_uids. Passing the ids parameter will perform a batch ID search. |
limit integer | 15 | (optional) The number of results to return. Only used in prefix and semantic searches. Limited to 1000, defaults to 10. |
GET /1/tenants/{tenant_id}/subjects
Host: https://api.cogniac.io
Example: Searching for Semantically Similar Subjects
curl -X GET https://api.cogniac.io/1/tenants/current/subjects?ids=cat \
-H "Authorization: Bearer abcdefg.hijklmnop.qrstuvwxyz"
import cogniac
cc = cogniac.CogniacConnection(username="[email protected]",
password="myPassword",
tenant_id="63QhzFLc9tg4")
cc.search_subjects(ids=[],
prefix=None,
similar='cat',
name=None,
tenant_owned=True,
public_read=False,
public_write=False,
limit=10)
{
"data": [
{
"created_at": 1478574780.947824,
"created_by": "[email protected]",
"description": null,
"modified_at": 1478574780.947824,
"name": "cat",
"public_read": true,
"public_write": false,
"subject_uid": "cat_lq1",
"tenant_id": "wh1Swty"
},
{
"created_at": 1478574787.262627,
"created_by": "[email protected]",
"description": null,
"modified_at": 1478574787.262627,
"name": "cat_roi",
"public_read": false,
"public_write": false,
"subject_uid": "cat_roi_bn2",
"tenant_id": "wh1Swty"
},
{
"created_at": 1478582892.811003,
"created_by": "[email protected]",
"description": null,
"modified_at": 1478582892.811003,
"name": "cat",
"public_read": true,
"public_write": false,
"subject_uid": "cat_8gf",
"tenant_id": "Oi23gt5a"
},
{
"created_at": 1478574780.557287,
"created_by": "[email protected]",
"description": null,
"modified_at": 1478574780.557287,
"name": "cat_and_dog",
"public_read": true,
"public_write": true,
"subject_uid": "cat_and_dog",
"tenant_id": "Oi23gt5a"
},
]
}
Updated over 4 years ago