Behavior API endpoint

Table of contents

  1. Fields
  2. List view
  3. Add
  4. Detail
  5. Change
  6. Delete

Fields

FieldDescription
idUUID identificator formatted as a string
sessionrelated session ID formatted as a string [required]
subjectslist of related subjects IDs formatted as strings [required]
setuprelated experimental setup ID formatted as a string [required]
behavioralassayrelated behavioral assay ID formatted as a string [required]
notesoptional string (max 500 characters) for additional information
orderoptional positive integer controlling display order within a session

List view

  • Allowed portals: public, private
  • Request method: GET
  • URL: https://www.brainstem.org/api/private/modules/behavior
  • Data: None
  • Responses: 200 OK; 403 Not allowed; 404 Not found

Use example (using Python API)

resp = client.load('behavior')

Response example

{'behaviors': [
	{
		'id': '<id>',
		'session': '<session-id>',
		'subjects': ['<id>'],
		'setup': '<setup-id>',
		'behavioralassay': '<behavioralassay-id>'
	},
	{
		'id': '<id>',
		'session': '<session-id>',
		'subjects': ['<id>', '<id>'],
		'setup': '<setup-id>',
		'behavioralassay': '<behavioralassay-id>'
	},
	{
		'id': '<id>',
		'session': '<session-id>',
		'subjects': ['<id>'],
		'setup': '<setup-id>',
		'behavioralassay': '<behavioralassay-id>'
	}
]}

Add

  • Allowed portals: private
  • Request method: POST
  • URL: https://www.brainstem.org/api/private/modules/behavior
  • Data: JSON dictionary containing at least the required fields.
  • Responses: 201 OK; 400 Bad request; 403 Not allowed; 404 Not found

Use example (using Python API)

resp = client.save("behavior",  data={
	"session": "<session-id>", 
	"subjects": ["<id>"],
	"setup": "<setup-id>",
	"behavioralassay": "<behavioralassay-id>",
	"notes": "Optional notes about this behavior"
})

Response example

{'behavior': 
	{
		'id': '<id>',
		'session': '<session-id>',
		'subjects': ['<id>'],
		'setup': '<setup-id>',
		'behavioralassay': '<behavioralassay-id>',
		'notes': 'Optional notes about this behavior'
	}
}

Detail

  • Allowed portals: public, private
  • Request method: GET
  • URL: https://www.brainstem.org/api/private/modules/behavior/<id>/
  • Data: None
  • Responses: 200 OK; 403 Not allowed; 404 Not found

Use example (using Python API)

resp = client.load('behavior', id='<id>')

Response example

{'behavior': 
	{
		'id': '<id>',
		'session': '<session-id>',
		'subjects': ['<id>'],
		'setup': '<setup-id>',
		'behavioralassay': '<behavioralassay-id>',
		'notes': 'Optional notes about this behavior'
	}
}

Change

  • Allowed portals: private
  • Request method: PATCH
  • URL: https://www.brainstem.org/api/private/modules/behavior/<id>/
  • Data: dictionary containing the fields to be updated
  • Responses: 200 OK; 400 Bad request; 403 Not allowed; 404 Not found

Use example (using Python API)

resp = client.save("behavior", id="<id>", data={'subjects': ['<id>', '<id>']})

Response example

{'behavior': 
	{
		'id': '<id>',
		'session': '<session-id>',
		'subjects': ['<id>', '<id>'],
		'setup': '<setup-id>',
		'behavioralassay': '<behavioralassay-id>',
		'notes': 'Optional notes about this behavior'
	}
}

Delete

  • Allowed portals: private
  • Request method: DELETE
  • URL: https://www.brainstem.org/api/private/modules/behavior/<id>/
  • Data: None
  • Responses: 204 OK; 400 Bad request; 403 Not allowed; 404 Not found

Use example (using Python API)

resp = client.delete("behavior", id="<id>")