Object specs and examples (JSON)

JSON attribute rules

For every object, available in our object model, we use the following rules to build its JSON representation:

Model type JSON representation
int <integer>
string “<string>”
datetime “YYYY-MM-DD HH:MM:SS”
float + units { “data”: <float>, “units”: “<string>” }
array of strings 1D { “data”: “<file_permalink>”, “units”: “dt” }
array of floats 1D + units { “data”: “<file_permalink>”, “units”: “<string>” }
array of floats 2D + units { “data”: “<file_permalink>”, “units”: “<string>” }
array of floats 3D + units { “data”: “<file_permalink>”, “units”: “<string>” }
foreign key “<parent_obj_permalink>”

Note. Available units values are listed here.

POST body examples

Here you may find a list of examples of HTTP request bodies for all supported objects. All examples provide an example POST request body to create a new object.

Electrophysiology

This is an example request to create a new Block:

Request: POST /electrophysiology/block/

{
    "name": "Block of recordings from May, 10",
    "filedatetime": "2012-09-17 18:08:15",
    "index": 1
}

Send the following HTTP POST request to create a new Segment and connect it to the Block with an ID = 1234:

Request: POST /electrophysiology/segment/

{
    "name": "Trial 1",
    "filedatetime": "2012-09-17 18:08:15",
    "index": 1,
    "block": 1234
}

You may create a new Event by sending the following HTTP POST:

Request: POST /electrophysiology/event/

{
    "time": {
        "data": 7.22,
        "units": "ms"
    },
    "label": "Stimuli end",
    "segment": 1,
    "eventarray": 1
}

In case you want to create an array of Events, first upload one file with labels and another file with times and then create an EventArray object (in this example it will be linked to the Segment 3847):

Request: POST /electrophysiology/eventarray/

{
    "segment": 3847,
    "times": {
        "data": "/datafiles/158867/",
        "units": "ms"
    },
    "labels": {
        "data": "/datafiles/158868/",
        "units": "ms"
    }
}

In some cases, instead of creating Events, you may find useful Epoch objects. Use HTTP POST request, similar to the following, to create new Epoch:

Request: POST /electrophysiology/epoch/

{
    "time": {
        "data": 78.22,
        "units": "ms"
    },
    "duration": {
        "data": 0.35,
        "units": "ms"
    },
    "label": "Displaying blue screen",
    "segment": 3847,
}

As with EventArray, you may want to organize several Epochs in an EpochArray. In this case you should create 3 arrays (for times, durations and labels) first, and then create the EpochArray object with the request, similar to

Request: POST /electrophysiology/epocharray/

{
    "segment": 1234,
    "times": {
        "data": "/datafiles/159690/",
        "units": "ms"
    },
    "durations": {
        "data": "/datafiles/159691/",
        "units": "ms"
    },
    "labels": {
        "data": "/datafiles/159692/",
        "units": "ms"
    }
}

If you use Tethrodes or any other type of “groups” of electrodes within your electrophysiological recording, you may want to consider creating a RecordingChannelGroup:

Request: POST /electrophysiology/recordingchannelgroup/

{
    "name": "Tethrode #5",
    "block": 12
}

To create a RecordingChannel, please send a request similar to (if you want to link it to the Tethrode (RecordingChannelGroup), indicate it with the “recordingchannelgroup” parameter):

Request: POST /electrophysiology/recordingchannel/

{
    "name": "Electrode #1",
    "index": 1,
    "recordingchannelgroup": 18
}

To create a Unit (usually representing a Neuron within the data model) please send an HTTP request, similar to:

Request: POST /electrophysiology/unit/

{
    "name": "Neuron 34.56 x 28.8 x 245.69",
    "recordingchannel": [
        67,
        68,
        69
    ]
}

Please notice, that in the case with Unit, you may specify several Recording Channels. Even if you need to relate Unit to only one channel, please use a list “[ ... ]” with only one value inside. You may use permalinks or just channel IDs, as per your convenience.

Please use the following HTTP request example to create AnalogSignal:

Request: POST /electrophysiology/analogsignal/

{
    "name": "AS-1",
    "sampling_rate": {
        "data": 20000,
        "units": "Hz"
    },
    "t_start": {
        "data": 0.0,
        "units": "ms"
    },
    "signal": {
        "units": "mV",
        "data": "/datafiles/167890/"
    },
    "segment": 1234,
    "recordingchannel": 1
}

Please note, the array with data (“/datafiles/167890/”) should be uploaded and validated prior to the object creation (this request).

If you have irregularly sampled signals, use the following request example to create IrSaAnalogSignal objects:

Request: POST /electrophysiology/irsaanalogsignal/

{
    "name": "ISAS-1",
    "t_start": {
        "data": -200.0,
        "units": "ms"
    },
    "signal": {
        "units": "mV",
        "data": "/datafiles/169890/"
    },
    "times": {
        "units": "ms",
        "data": "/datafiles/169891/"
    },
    "segment": 1234,
    "recordingchannel": 1
}

As with all other data-related objects, arrays with data (“/datafiles/167890/”) and times (“/datafiles/169891/”) should be uploaded and validated prior to the object creation (this request).

By analogy with AnalogSignal, use the following request to create AnalogSignalArray (upload array data first):

Request: POST /electrophysiology/analogsignalarray/

{
    "sampling_rate": {
        "data": 20000,
        "units": "Hz"
    },
    "t_start": {
        "data": 0.0,
        "units": "ms"
    },
    "signal": {
        "units": "mV",
        "data": "/datafiles/180138/"
    },
    "segment": 1234,
    "recordingchannel": 1
}

This is an example request to create a single Spike (upload waveform data first):

Request: POST /electrophysiology/spike/

{
    "time": {
        "data": 300.0,
        "units": "ms"
    },
    "sampling_rate": {
        "data": 20.0,
        "units": "kHz"
    },
    "left_sweep": {
        "data": 15.0,
        "units": "ms"
    },
    "waveform": {
        "data": "/datafiles/180148/",
        "units": "ms"
    },
    "segment": 1234,
    "unit": 56
}

And this is an example for a SpikeTrain:

Request: POST /electrophysiology/spiketrain/

{
    "t_start": {
        "data": -400.0,
        "units": "ms"
    },
    "t_stop": {
        "data": 800.0,
        "units": "ms"
    },
    "times": {
        "units": "ms",
        "data": "/datafiles/190388/",
    },
    "segment": 1234,
    "unit": 56
}

Metadata

Send the following HTTP POST request to create a new Section:

Request: POST /metadata/section/

{
    "name": "Electrode",
    "tree_position": 1,
    "odml_type": 0,
    "safety_level": 3,
    "description": "Settings and other experimental setup"
}

Create new Property inside the Section with ID 1456 with the following request:

Request: POST /metadata/property/

{
    "comment": "insert some comments here..",
    "definition": "the type of the recording",
    "name": "recording type",
    "dependency_value": "",
    "dtype": "",
    "uncertainty": "",
    "mapping": "",
    "dependency": "",
    "safety_level": 3,
    "unit": ""
    "section": 1456,
}

This request is used to create new Value:

Request: POST /metadata/value/

{
    "parent_property": 3,
    "data": "extracellular"
}

Datafiles

To upload a file you should send an HTTP POST request with the file attached with the key “raw_file” in the request body. Read more about working with files here.

Table Of Contents

Related Topics

This Page