Constructor
new Subject(jsXnat)
Constructor
.Constructor
Parameters:
Name | Type | Description |
---|---|---|
jsXnat |
JsXnat |
- Source:
Members
SubjectXmlPathShortcuts
Subject Xml Path Shortcuts objects
.Subject Xml Path Shortcuts objects
- Source:
Methods
createFolder(projectId, subjectIdOrLabel, resourceLabel, format, tags, contents, cb)
Create A New Project Resource Folder
.Create A New Project Resource Folder
Parameters:
Name | Type | Description |
---|---|---|
projectId |
string | project id |
subjectIdOrLabel |
string | subject id or label |
resourceLabel |
string | resource label (folder name) |
format |
string | Optional. Specify a string format descriptor for this resource folder. |
tags |
string | array | Optional. Specify a comma-separated list of tags for this resource folder. |
contents |
string | Optional. Specify a string description of the resource folder's content. |
cb |
function | optional callback function |
- Source:
Returns:
none
createSimpleSubject(projectId, subjectLabel, cb)
Create an empty subject
.Create an empty subject
Parameters:
Name | Type | Description |
---|---|---|
projectId |
string | project id |
subjectLabel |
string | subject label |
cb |
function | optional callback function |
- Source:
createSubject(projectId, subjectLabel, json, cb)
Create a subject
.Create a subject
Parameters:
Name | Type | Description |
---|---|---|
projectId |
string | project id |
subjectLabel |
string | subject label |
json |
object | object type project data |
cb |
function | optional callback function |
- Source:
createSubjectWithRawXml(projectId, xml, name, cb)
Create a project represented by XML
.Create a project represented by XML
Parameters:
Name | Type | Description |
---|---|---|
projectId |
string | project id |
xml |
string | project xml representation |
name |
string | project name |
cb |
function | optional callback function |
- Source:
Returns:
new subject's XNAT accession ID e.g., XNAT_S00036
deleteFile(projectId, subjectIdOrLabel, resourceIdOrLabel, filename, cb)
Delete A Project Resource File
.Delete A Project Resource File
Parameters:
Name | Type | Description |
---|---|---|
projectId |
string | project id |
subjectIdOrLabel |
string | subject id or label |
resourceIdOrLabel |
string | resource id or label (folder name) |
filename |
string | filename |
cb |
function | optional callback function |
- Source:
Returns:
none
deleteFolder(projectId, subjectIdOrLabel, resourceIdOrLabel, safe, cb)
Delete A Project Resource Folder
.Delete A Project Resource Folder
Parameters:
Name | Type | Default | Description |
---|---|---|---|
projectId |
string | project id |
|
subjectIdOrLabel |
string | subject id or label |
|
resourceIdOrLabel |
string | resource id or label (folder name) |
|
safe |
boolean | false | Optional. if throw errors if files exists in the resource folder |
cb |
function | optional callback function |
- Source:
Returns:
none
deleteSubject(projectId, subjectLabel, cb)
Delete (Or Unshare) A Subject Record
.Delete (Or Unshare) A Subject Record
Parameters:
Name | Type | Description |
---|---|---|
projectId |
string | project id |
subjectLabel |
string | subject label |
cb |
function | optional callback function |
- Source:
Returns:
none
getAllSubjects(columns, format, cb)
Get a listing of all subjects
.Get a listing of all subjects
Parameters:
Name | Type | Description |
---|---|---|
columns |
string | array | Optional. Column names can be either properties of SubjectXmlPathShortcuts or XML Path Shortcuts: https://wiki.xnat.org/display/XAPI/Subject+Data+REST+XML+Path+Shortcuts |
format |
string | Optional. Set the format of the response. Format value can be json, html, xml, or csv. If not specified, default is JSON |
cb |
function | optional callback function |
- Source:
getFile(projectId, subjectIdOrLabel, resourceIdOrLabel, filename, cb)
Get A Listing Of Resource Files Stored With A Project
.Get A Listing Of Resource Files Stored With A Project
Parameters:
Name | Type | Description |
---|---|---|
projectId |
string | project id |
subjectIdOrLabel |
string | subject id or label |
resourceIdOrLabel |
string | resource id or label (folder name) |
filename |
string | filename |
cb |
function | optional callback function |
- Source:
getFiles(projectId, subjectIdOrLabel, sortBy, format, cb)
Get A Listing Of Resource Files Stored With A Project
.Get A Listing Of Resource Files Stored With A Project
Parameters:
Name | Type | Description |
---|---|---|
projectId |
string | project id |
subjectIdOrLabel |
string | subject id or label |
sortBy |
array | string | Optional. Sort the returned results by one or more parameters in the Result array. Multiple parameters can be provided |
format |
string | Optional. Set the format of the response. Format value can be json, html, xml, or csv. If not specified, default is JSON |
cb |
function | optional callback function |
- Source:
getFolders(projectId, subjectIdOrLabel, sortBy, format, cb)
Get A Listing Of Resource Folders Stored With A Subject
.Get A Listing Of Resource Folders Stored With A Subject
Parameters:
Name | Type | Description |
---|---|---|
projectId |
string | project id |
subjectIdOrLabel |
string | subject id or label |
sortBy |
array | string | Optional. Sort the returned results by one or more parameters in the Result array. Multiple parameters can be provided |
format |
string | Optional. Set the format of the response. Format value can be json, html, xml, or csv. If not specified, default is JSON |
cb |
function | optional callback function |
- Source:
getSharedProjects(projectId, subjectIdOrLabel, format, cb)
Get A List Of Shared Projects Associated With A Subject
.Get A List Of Shared Projects Associated With A Subject
Parameters:
Name | Type | Description |
---|---|---|
projectId |
string | project id |
subjectIdOrLabel |
string | subject label |
format |
string | Optional. Set the format of the response. Format value can be json, html, xml, or csv. If not specified, default is JSON |
cb |
function | optional callback function |
- Source:
Returns:
a list of all projects associated with a subject. The root project ID in the URI can be either a project that owns the subject or a shared project.
getSubject(format, cb)
Get a single subject
.Get a single subject
Parameters:
Name | Type | Description |
---|---|---|
options.projectId |
string | project id |
options.subjectId |
string | subject id |
options.subjectLabel |
string | subject label |
format |
string | Optional. Set the format of the response. json by default |
cb |
function | optional callback function |
- Source:
getSubjectBySubjectId(subjectId, format, cb)
Get a single subject by a project id and subject label
.Get a single subject by a project id and subject label
Parameters:
Name | Type | Description |
---|---|---|
subjectId |
string | subject id |
format |
string | Optional. Set the format of the response. json by default |
cb |
function | optional callback function |
- Source:
getSubjectBySubjectLabel(projectId, subjectLabel, format, cb)
Get a single subject by a project id and a subject label
.Get a single subject by a project id and a subject label
Parameters:
Name | Type | Description |
---|---|---|
projectId |
string | project id |
subjectLabel |
string | subject label |
format |
string | Optional. Set the format of the response. json by default |
cb |
function | optional callback function |
- Source:
getSubjects(projectId, columns, format, cb)
Get a listing of all subjects
.Get a listing of all subjects
Parameters:
Name | Type | Description |
---|---|---|
projectId |
string | project id |
columns |
string | array | Optional. Column names can be either properties of SubjectXmlPathShortcuts or XML Path Shortcuts: https://wiki.xnat.org/display/XAPI/Subject+Data+REST+XML+Path+Shortcuts |
format |
string | Optional. Set the format of the response. Format value can be json, html, xml, or csv. If not specified, default is JSON |
cb |
function | optional callback function |
- Source:
shareSubject(originalProjectId, sharedProjectId, subjectIdOrLabel, newLabel, primary, format, cb)
Share A Subject Into A New Project
.Share A Subject Into A New Project
Parameters:
Name | Type | Default | Description |
---|---|---|---|
originalProjectId |
string | the ID of the project that owns a given subject. |
|
sharedProjectId |
string | the ID of the project that you intend a subject to be shared into |
|
subjectIdOrLabel |
string | subject id or label to be shared |
|
newLabel |
string | Optional. Specify a new label for this subject that will be used in the shared project, if desired. |
|
primary |
string | false | Optional. If set to "true", you are changing the primary ownership of the subject from the original project to the new project. |
format |
string | Optional. Set the format of the response. json by default |
|
cb |
function | optional callback function |
- Source:
unshareSubject(projectId, subjectLabel, cb)
Delete (Or Unshare) A Subject Record
.Delete (Or Unshare) A Subject Record
Parameters:
Name | Type | Description |
---|---|---|
projectId |
string | project id |
subjectLabel |
string | subject label |
cb |
function | optional callback function |
- Source:
Returns:
none
updateSubject(subjectId, json, cb)
Update a subject
.Update a subject
Parameters:
Name | Type | Description |
---|---|---|
subjectId |
string | subject id |
json |
object | object type project data |
cb |
function | optional callback function |
- Source:
updateSubjectBySubjectLabel(json, cb)
Update a subject by subject label
.Update a subject by subject label
Parameters:
Name | Type | Description |
---|---|---|
options.projectId |
string | project id |
options.subjectLabel |
string | subject label |
json |
object | object type project data |
cb |
function | optional callback function |
- Source:
updateSubjectWithRawXml(xml, cb)
Update a subject represented by XML
.Update a subject represented by XML
Parameters:
Name | Type | Description |
---|---|---|
options.projectId |
string | project id |
options.subjectId |
string | subject id |
options.subjectLabel |
string | subject label |
xml |
string | project xml representation |
cb |
function | optional callback function |
- Source:
uploadFile(projectId, subjectIdOrLabel, resourceIdOrLabel, filename, file, overwrite, cb)
Upload A New Project Resource File
.Upload A New Project Resource File
Parameters:
Name | Type | Default | Description |
---|---|---|---|
projectId |
string | project id |
|
subjectIdOrLabel |
string | subject id or label |
|
resourceIdOrLabel |
string | resource id or label (folder name) |
|
filename |
string | filename |
|
file |
Buffer | file buffer (need to check if this is compatilable from browser) |
|
overwrite |
boolean | false | Optional. overwrite the file if the file that has the same filename already exists in the same location |
cb |
function | optional callback function |
- Source:
Returns:
none