Equipment API endpoint

Table of contents

  1. Fields
  2. Types of equipment
  3. List view
  4. Add
  5. Detail
  6. Change
  7. Delete

Fields

FieldDescription
idUUID identificator formatted as a string
namedescriptive name for the equipment
typestring [required]. See options below
notesstring [max length: 500]
setuprelated experimental setup ID formatted as a string [required]
date_timestring containing date and time (ISO 8601)
consumablerelated consumable ID formatted as a string
hardwaredevicerelated hardware device ID formatted as a string
detailsJSON object mapped to the internal type_json field. See accepted schemas below
type_schema_versionstring schema version for details
coordinates_systemstring [required]. See options below
coordinates_detailsJSON object mapped to the internal coordinates_json field. See accepted schemas below
coordinates_schema_versionstring schema version for coordinates_details

Most equipment schemas currently expose no additional fields, so the API may return an empty {} for details unless new properties are defined.

Types of equipment

A detailed list of the available type options and accepted schemas for the details and coordinates_details fields can be found in the Equipment schemas documentation and Coordinates schemas documentation.

List view

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

Use example (using Python API)

resp = client.load_model('equipment')

Response example

{'equipment': [
    {
        'id': '00000000-0000-0000-0000-000000000000',
        'name': 'Headstage amplifier',
        'type': 'Amplifier',
        'notes': '32-channel preamp',
        'setup': '00000000-0000-0000-0000-000000000000',
        'date_time': '2024-03-05T10:00:00Z',
        'consumable': None,
        'hardwaredevice': '00000000-0000-0000-0000-000000000000',
        'details': {},
        'type_schema_version': '0.0.0',
        'coordinates_system': 'External_XYZ_Absolute',
        'coordinates_details': {
            'x': 0.0,
            'y': 0.0,
            'z': 0.0,
            'xAngle': 0.0,
            'yAngle': 0.0,
            'zAngle': 0.0
        },
        'coordinates_schema_version': '0.0.0'
    },
    {
        'id': '00000000-0000-0000-0000-000000000000',
        'name': 'Two-photon rig',
        'type': 'TwoPhotonMicroscope',
        'notes': 'Imaging setup',
        'setup': '00000000-0000-0000-0000-000000000000',
        'date_time': None,
        'consumable': None,
        'hardwaredevice': None,
        'details': {},
        'type_schema_version': '0.0.0',
        'coordinates_system': 'External_XYZ_Absolute',
        'coordinates_details': {
            'x': 120.0,
            'y': 45.0,
            'z': 0.0,
            'xAngle': 0.0,
            'yAngle': 0.0,
            'zAngle': 0.0
        },
        'coordinates_schema_version': '0.0.0'
    }
]}

Add

  • Allowed portals: private
  • Request method: POST
  • URL: https://www.brainstem.org/api/private/modules/equipment
  • 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_model(
    "equipment",
    data={
        "name": "Fiber photometry console",
        "type": "FiberPhotometrySystem",
        "setup": "00000000-0000-0000-0000-000000000000",
        "hardwaredevice": "00000000-0000-0000-0000-000000000000",
        "notes": "Main recording rig",
        "details": {},
        "coordinates_system": "External_XYZ_Absolute",
        "coordinates_details": {
            "x": 1.0,
            "y": 2.0,
            "z": 3.0,
            "xAngle": 4.0,
            "yAngle": 5.0,
            "zAngle": 6.0
        }
    }
)

Response example

{'equipment': {
    'id': '00000000-0000-0000-0000-000000000000',
    'name': 'Fiber photometry console',
    'type': 'FiberPhotometrySystem',
    'notes': 'Main recording rig',
    'setup': '00000000-0000-0000-0000-000000000000',
    'date_time': None,
    'consumable': None,
    'hardwaredevice': '00000000-0000-0000-0000-000000000000',
    'details': {},
    'type_schema_version': '0.0.0',
    'coordinates_system': 'External_XYZ_Absolute',
    'coordinates_details': {
        'x': 1.0,
        'y': 2.0,
        'z': 3.0,
        'xAngle': 4.0,
        'yAngle': 5.0,
        'zAngle': 6.0
    },
    'coordinates_schema_version': '0.0.0'
}}

Detail

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

Use example (using Python API)

resp = client.load_model('equipment', id='00000000-0000-0000-0000-000000000000')

Response example

{'equipment': {
    'id': '00000000-0000-0000-0000-000000000000',
    'name': 'Fiber photometry console',
    'type': 'FiberPhotometrySystem',
    'notes': 'Main recording rig',
    'setup': '00000000-0000-0000-0000-000000000000',
    'date_time': None,
    'consumable': None,
    'hardwaredevice': '00000000-0000-0000-0000-000000000000',
    'details': {},
    'type_schema_version': '0.0.0',
    'coordinates_system': 'External_XYZ_Absolute',
    'coordinates_details': {
        'x': 1.0,
        'y': 2.0,
        'z': 3.0,
        'xAngle': 4.0,
        'yAngle': 5.0,
        'zAngle': 6.0
    },
    'coordinates_schema_version': '0.0.0'
}}

Change

  • Allowed portals: private
  • Request method: PATCH
  • URL: https://www.brainstem.org/api/private/modules/equipment/<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_model(
    "equipment",
    id="00000000-0000-0000-0000-000000000000",
    data={"notes": "Updated calibration complete"}
)

Response example

{'equipment': {
    'id': '00000000-0000-0000-0000-000000000000',
    'name': 'Fiber photometry console',
    'type': 'FiberPhotometrySystem',
    'notes': 'Updated calibration complete',
    'setup': '00000000-0000-0000-0000-000000000000',
    'date_time': None,
    'consumable': None,
    'hardwaredevice': '00000000-0000-0000-0000-000000000000',
    'details': {},
    'type_schema_version': '0.0.0',
    'coordinates_system': 'External_XYZ_Absolute',
    'coordinates_details': {
        'x': 1.0,
        'y': 2.0,
        'z': 3.0,
        'xAngle': 4.0,
        'yAngle': 5.0,
        'zAngle': 6.0
    },
    'coordinates_schema_version': '0.0.0'
}}

Delete

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

Use example (using Python API)

resp = client.delete_model("equipment", id="00000000-0000-0000-0000-000000000000")