A Web API offers programmatic access to the content of a web application.
The Django-REST-API provides an in-browser interface for interacting with the Web API, but generally one will access the data from a script in a language like Python.
The Django-REST-API provides an in-browser interface for interacting with the Web API, but generally one will access the data from a script in a language like Python.
Info:
The data is highly nested (entries tend to link to another entry), so the current organization attempts to decrease data sparsity by returning complicated objects as separate entities that are linked via an ID rather than having their contents listed explicitly and redundantly everywhere they are relevant.
Currently, the API has the following endpoints:
Currently, the API has the following endpoints:
- Viewing the Study List (/api/studies/)
- Viewing an individual Study (/api/studies/{id}/)
- Viewing a list of Targets (/api/targets/)
- Viewing a list of Methods (/api/methods/)
- Viewing a list of Units (/api/units/)
- Viewing a list of Experimental Model Locations (/api/locations/)
Info:
Only publicly accessible Studies (those that are Signed Off and marked Unrestricted) and Discoverable Studies (Studies for which only a subset of metadata is publicly accessible) are available in the API.
Info:
For every Public and/or Discoverable Study, the following are returned:
- access_status
- id
- url link to the api details page (so a user can click the link rather than typing in the id)
- name
- created_on
- modified_on
- data_group
- center
- pi
- contact_person
- study_types (TOX, CC, etc.)
- start_date (in ISO yyyy-mm-dd)
- description
Info:
For an individual Study, the following fields are returned. Fields marked with an asterisk (*) are provided for Public and Discoverable Studies, other fields are only present for publicly available Studies.
- access_status*
- id*
- name*
- created_on*
- modified_on*
- data_group*
- center*
- pi*
- contact_person*
- study_types (TOX, CC, etc.)*
- start_date (in ISO yyyy-mm-dd)*
- description*
- study_description_image*
- supporting_data*
- processed_data_files
- omic_data_files
- assay_plate_data_files
-
groups: matches group ids to:
- mps_model
- mps_model_version
-
compounds: a list which contains:
- compound
- supplier
- lot
- receipt_date
- concentration
- concentration_unit
- addition_time
- addition_time_in_minutes
- duration
- duration_in_minutes
- addition_location
-
cells: a list which contains:
- cell_sample
- biosensor
- density
- density_unit
- passage
- addition_time
- addition_time_in_minutes
- addition_location
-
settings: a list which contains:
- setting
- value
- unit
- addition_time
- addition_time_in_minutes
- duration
- duration_in_minutes
- addition_location
-
items: matches item ids to:
- group_id
- name
- scientist
- notebook
- notebook_page
- notes
-
assays: matches assay ids to:
- target
- method
- unit
-
data: a list of data points containing:
- item_id
- assay_id
- sample_location
- value
- cross_reference
- time
- time_in_minutes
- notes
- assay_plate_id
- assay_well_id
- replicate
- excluded
- replaced
- update_number
Info:
Study Component lists include an id, name and description.
- Viewing a list of Targets (/api/targets/)
- Viewing a list of Methods (/api/methods/)
- Viewing a list of Units (/api/units/)
- Viewing a list of Experimental Model Locations (/api/locations/)
# This library will help you make requests
# There are other similar libraries, requests is popular but not built-in to python
# requests is a library that will help you make API requests
import urllib.request
# Processing the data can be done with the standard JSON parser
import json
# In this example, we get the study list:
# Just have a string of the url for the API study list
study_list_url = 'https://biosystics-ap.com/api/studies/'
# And make a request with the library
# This response should contain a string of the response
study_list_response = urllib.request.urlopen(study_list_url)
# We can parse it with json
# Now it will be comprised of Python objects rather than strings
study_list_parsed = json.loads(study_list_response.read())
# This will print the first study in the list
print(study_list_parsed[0])
# Something similar can be done with particular studies
study_id = 23
study_url = 'https://biosystics-ap.com/api/studies/{}/'.format(study_id)
study_response = urllib.request.urlopen(study_url)
study_parsed = json.loads(study_response.read())
# This will print the study's name
print(study_parsed.get('name'))
Info:
The In-Browser Interface provided by Django-Rest-Framework can be accessed by visiting the URLs one would use in a script directly in the browser.
URLs pointing to something in the API should be clickable.
You might notice that copying and pasting the data is somewhat difficult in the default display. Clicking the down arrow next to the GET button (which effectively acts as a refresh button) gives one the opportunity to select the "json" format. Selecting json will show the raw json to your browser (which may or may not attempt to make it more presentable). From here, it should be easier to copy and paste the data.
Click here for the API list of Studies
URLs pointing to something in the API should be clickable.
You might notice that copying and pasting the data is somewhat difficult in the default display. Clicking the down arrow next to the GET button (which effectively acts as a refresh button) gives one the opportunity to select the "json" format. Selecting json will show the raw json to your browser (which may or may not attempt to make it more presentable). From here, it should be easier to copy and paste the data.