Cortex API
Search…
createSubject
This method is to create a new subject. Then you can associate the subject to a record when you call createRecord.
This method was added in Cortex 2.1

Parameters

Name
Type
Required
Description
cortexToken
string
yes
A token returned by authorize.
subjectName
string
yes
The name of the subject. Must be 30 characters or less.
dateOfBirth
string
no
The date of birth of the subject. The format must be "YYYY-MM-DD", e.g. "1980-12-25".
sex
string
no
Must be "M", "F" or "U". These letters stands for male, female and unknown respectively.
countryCode
string
no
The Alpha-2 ISO code of the country the subject lives in.
state
string
no
The state the subject lives in.
city
string
no
The city the subject lives in.
attributes
array of objects
no
A list of demographic attribute objects. See Subject object.

Result

The result is a subject object representing the new subject.

Examples

Create a subject with only his name.
Request
Response
1
{
2
"id": 1,
3
"jsonrpc": "2.0",
4
"method": "createSubject",
5
"params": {
6
"cortexToken": "xxx",
7
"subjectName": "Bob Smith"
8
}
9
}
Copied!
1
{
2
"id": 1,
3
"jsonrpc": "2.0",
4
"result": {
5
"attributes": [],
6
"city": "",
7
"countryCode": "",
8
"countryName": "",
9
"dateOfBirth": "",
10
"experimentsCount": 0,
11
"modifiedDatetime": "2019-07-01T11:41:25.270+07:00",
12
"sex": "U",
13
"state": "",
14
"subjectName": "Bob Smith"
15
}
16
}
Copied!
Create a subject with more information.
Request
Response
1
{
2
"id": 1,
3
"jsonrpc": "2.0",
4
"method": "createSubject",
5
"params": {
6
"cortexToken": "xxx",
7
"subjectName": "Alice Smith",
8
"city": "London",
9
"countryCode": "GB",
10
"dateOfBirth": "1980-12-25",
11
"sex": "F",
12
"attributes": [
13
{
14
"name": "Handedness",
15
"value": "Left"
16
},
17
{
18
"name": "Education",
19
"value": "Master's degree"
20
}
21
]
22
}
23
}
Copied!
1
{
2
"id": 1,
3
"jsonrpc": "2.0",
4
"result": {
5
"attributes": [
6
{
7
"name": "Handedness",
8
"value": "Left"
9
},
10
{
11
"name": "Education",
12
"value": "Master's degree"
13
}
14
],
15
"city": "London",
16
"countryCode": "GB",
17
"countryName": "",
18
"dateOfBirth": "1980-12-25",
19
"experimentsCount": 0,
20
"modifiedDatetime": "2019-07-01T11:23:11.644+07:00",
21
"sex": "F",
22
"state": "",
23
"subjectName": "Alice Smith"
24
}
25
}
Copied!
Copy link