Subjects - Update
  • 22 Dec 2023
  • 1 Minute to read
  • Dark
    Light

Subjects - Update

  • Dark
    Light

Article summary

Update Subject

The following fields can be updated (with certain restrictions).

Name

Example

Description

name
string

"Cat"

Brief descriptive name of the subject. Can be multiple words, with max_length <= 70

description
string

"Domestic cats only."

Full description of the subject. Use this field to capture detailed subject semantics and feedback instructions.

POST /1/subjects/{subject_uid}/cat_123
Host: https://api.cogniac.io

Example: Update a Subject

curl -X POST https://api.cogniac.io/1/subjects/cat_123 \
-H "Authorization: Bearer abcdefg.hijklmnop.qrstuvwxyz" \
-H "Content-Type: application/json" \
-d '{
"name":"Cats and Dogs",
"description":"Cats and dogs from catdoor camera"
}' | json_pp
import cogniac

cc = cogniac.CogniacConnection(username="test@cogniac.co", 
                               password="myPassword", 
                               tenant_id="63QhzFLc9tg4")

# retrieve the subject_uid to change
subject = cc.get_subject("cat_123")

# update the subject by changing attribute values
subject.name = "Cats and Dogs"
subject.description = "Cats and dogs from catdoor camera"

print(subject.name)
print(subject.description)
{
Cats and Dogs
Cats and dogs from catdoor camera
}

Subject Name

A subject's name field can be changed without affecting pre-existing media associations. A subject_uid never changes.

Most subjects are one-word and use standard characters. Still, non-standard and diacritic characters are allowed, and it is possible to include upper-case characters and multiple words in a subject name.


Was this article helpful?