Link Search Menu Expand Document

Data storage 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
namestring [required] [max length: 100]
descriptionstring [max length: 500]
is_publicboolean
data_organization_jsonJSON dictionary
data_protocols_jsonJSON dictionary

List view

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

Use example (using Python API)

resp = client.load_model('datastorage')

Response example

{'datastorage': [
    {
        'id': '2ba92d91-349d-4e8c-9785-fc941ddd8868',
        'name': 'Peters testdata',
        'description': '',
        'is_public': False,
        'data_organization_json': [],
        'data_protocols_json': []
    },
    {
        'id': 'c2197dea-eab6-4bbc-8257-3f05537ffdb6',
        'name': "Rodrigo's data",
        'description': '',
        'is_public': False,
        'data_organization_json': [
                {
                    "elements": "Datasets"
                },
                {
                    "elements": "Subjects"
                }
            ],
        'data_protocols_json': [
                {
                    "protocol": "Dropbox (Cloud solution)",
                    "path": "data/myproject",
                    "is_public": true
                },
                {
                    "protocol": "Local harddrive",
                    "path": "/home/myuser/data/myproject",
                    "is_public": false
                }
            ]
    }
]}

Add

  • Allowed portals: private, super
  • Request method: POST
  • URL: https://www.brainstem.org/api/private/personal_attributes/datastorage
  • 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("datastorage",  data=
    {
        'name': "MyNewRepo",
        'data_organization_json': [
                {
                    "elements": "Datasets"
                },
                {
                    "elements": "Subjects"
                }
            ],
        'data_protocols_json': [
                {
                    "protocol": "Dropbox (Cloud solution)",
                    "path": "data/myproject",
                    "is_public": True
                },
                {
                    "protocol": "Local harddrive",
                    "path": "/home/myuser/data/myproject",
                    "is_public": False
                }
            ]
    }
)

Response example

{'datastorage': {
    'id': '9f322057-cf48-4ec7-ab19-d0d7175cffe2',
    'name': 'MyNewRepo',
    'description': '',
    'is_public': False,
    'data_organization_json': [
                {
                    "elements": "Datasets"
                },
                {
                    "elements": "Subjects"
                }
            ],
    'data_protocols_json': [
                {
                    "protocol": "Dropbox (Cloud solution)",
                    "path": "data/myproject",
                    "is_public": true
                },
                {
                    "protocol": "Local harddrive",
                    "path": "/home/myuser/data/myproject",
                    "is_public": false
                }
            ]}
}

Detail

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

Use example (using Python API)

resp = client.load_model('datastorage', id='9f322057-cf48-4ec7-ab19-d0d7175cffe2')

Response example

{'datastorage': {
    'id': '9f322057-cf48-4ec7-ab19-d0d7175cffe2',
    'name': 'MyNewRepo',
    'description': '',
    'is_public': False,
    'data_organization_json': [
                {
                    "elements": "Datasets"
                },
                {
                    "elements": "Subjects"
                }
            ],
    'data_protocols_json': [
                {
                    "protocol": "Dropbox (Cloud solution)",
                    "path": "data/myproject",
                    "is_public": true
                },
                {
                    "protocol": "Local harddrive",
                    "path": "/home/myuser/data/myproject",
                    "is_public": false
                }
            ]}
}

Change

  • Allowed portals: private, super
  • Request method: PATCH
  • URL: https://www.brainstem.org/api/private/personal_attributes/datastorage/<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("datastorage", id="9f322057-cf48-4ec7-ab19-d0d7175cffe2", data={"description": "new text"})

Response example

{'datastorage': {
    'id': '9f322057-cf48-4ec7-ab19-d0d7175cffe2',
    'name': 'MyNewRepo',
    'description': 'new text',
    'is_public': False,
    'data_organization_json': [
                {
                    "elements": "Datasets"
                },
                {
                    "elements": "Subjects"
                }
            ],
    'data_protocols_json': [
                {
                    "protocol": "Dropbox (Cloud solution)",
                    "path": "data/myproject",
                    "is_public": true
                },
                {
                    "protocol": "Local harddrive",
                    "path": "/home/myuser/data/myproject",
                    "is_public": false
                }
            ]}
}

Delete

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

Use example (using Python API)

resp = client.delete_model("datastorage", id="9f322057-cf48-4ec7-ab19-d0d7175cffe2")