Inventory 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: 50]
descriptionstring [max length: 500]
is_publicboolean

List view

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

Use example (using Python API)

resp = client.load_model('inventory')

Response example

{'inventories': [
    {
        'id': '58e0003d-16c2-4264-913d-288463c0356d',
        'name': 'My probe inventory',
        'description': '',
        'is_public': False
    },
    {
        'id': '3e9ec0e0-d685-42ec-8386-0fa24602a73e',
        'name': "My virus inventory",
        'description': '',
        'is_public': True
    }
]}

Add

  • Allowed portals: private, super
  • Request method: POST
  • URL: https://www.brainstem.org/api/private/personal_attributes/inventory
  • 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("inventory",  data=
    {
        'name': 'My new probe inventory',
        'description': '',
        'is_public': False
    }
)

Response example

{'inventory': {
    'id': 'd0ada97d-8607-48da-817b-bdd54bc9077b',
    'name': 'My new probe inventory',
    'description': '',
    'is_public': False}
}

Detail

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

Use example (using Python API)

resp = client.load_model('inventory', id='d0ada97d-8607-48da-817b-bdd54bc9077b')

Response example

{'inventory': {
    'id': 'd0ada97d-8607-48da-817b-bdd54bc9077b',
    'name': 'My new probe inventory',
    'description': '',
    'is_public': False}
}

Change

  • Allowed portals: private, super
  • Request method: PATCH
  • URL: https://www.brainstem.org/api/private/personal_attributes/inventory/<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("inventory", id="d0ada97d-8607-48da-817b-bdd54bc9077b", data={"description": "new text"})

Response example

{'inventory': {
    'id': 'd0ada97d-8607-48da-817b-bdd54bc9077b',
    'name': 'My new probe inventory',
    'description': 'new text',
    'is_public': False}
}

Delete

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

Use example (using Python API)

resp = client.delete_model("inventory", id="d0ada97d-8607-48da-817b-bdd54bc9077b")