Skip to content
pm9-sanger edited this page Sep 12, 2017 · 10 revisions

Please Note: The RESTful web service layer on this repository is only recommended for entering data into the repository. If your sole goal is to query the data in the repository, we would recommend using the BioMart instead. Details on accessing the data via this interface are described in Accessing Data via The BioMart.

WARNING: If you are writing code to use the services supplied by iMits, please ensure that you try to throttle the number of requests you send at once - i.e. put a small 'sleep' in your code after a batch of requests. This will guarantee that our service remains responsive to your requests and it will also keep the systems group here happy as we will not be swamping their front-end proxies. Thank you.

Please see the Tutorial page for usage examples.

Resources

This list shows the resources available, and the CRUD actions to be performed on them.

All the actions support JSON.

Resource Action
mi_plans GET,POST,PUT
mi_attempts GET,POST,PUT
phenotype_attempts GET,POST,PUT

Fields

The Authoritative Way

The authoritative way of getting the list of fields in the Imits application for the above 3 resources is via the REST API itself. Hit the the following end-points via a web browser or otherwise to get a JSON document representing the list of readable and writeable fields for each resource.

mi_plans

https://www.i-dcc.org/imits/mi_plans/attributes

mi_attempts

https://www.i-dcc.org/imits/mi_attempts/attributes

phenotype_attempts

mouse_allele_mods

mi_plan_id

mi_attempt_colony_name

colony_name

cre_excision_required

rederivation_started

rederivation_complete

number_of_cre_matings_successful

mouse_allele_type

deleter_strain_name

colony_background_strain_name

tat_cre

report_to_public

is_active

phenotyping_productions

id

phenotype_attempt_id

mi_plan_id

marker_symbol

mgi_accession_id

cohort_production_centre_name

production_centre_name

production_consortium_name

production_colony_name

phenotyping_centre_name

consortium_name

colony_name (Phenotyping Cohort Colony Name)

rederivation_started

rederivation_complete

colony_background_strain_name

phenotyping_experiments_started

phenotyping_started

phenotyping_complete

status_name

report_to_public

is_active

late_adult_status_name

selected_for_late_adult_phenotyping

late_adult_phenotyping_experiments_started

late_adult_phenotyping_started

late_adult_phenotyping_complete

late_adult_report_to_public

late_adult_is_active

tissue_distribution_centres_attributes

_destroy

es_cells

https://www.i-dcc.org/imits/targ_rep/es_cells/attributes

alleles

https://www.i-dcc.org/imits/targ_rep/alleles/attributes

Searching using the API

iMits supports advanced searching by the above fields on each resource. Any of the fields above can be used as part of the search. Multiple fields may be used in the search and MI attempts matching all the criteria will be returned.

Examples of searches that can be performed

https://www.i-dcc.org/imits/mi_attempts.json?es_cell_name_eq=EPD0127_4_E01

The above returns all MI attempts on the ES cell EPD0127_4_E01

Encoding URI parameter arguments

When search with strings containing characters other than a-z or an _ you must URI encode the string, this is to ensure that the system can correctly interpret the parameters you've sent in. Characters like ampersands (&) and semicolons (;) cannot be used as arguments of URI parameters.

For example this EsCell name has a semicolon;

B6Dnk;129P2-HBP1<Gt(EUCJ0053g09)>/H

It should be escaped to this;

B6Dnk%3B129P2-HBP1%3CGt(EUCJ0053g09)%3E%2FH

There are many online resources you can use to do this, if you would like to do it on a case by case basis you can use this website http://meyerweb.com/eric/tools/dencoder/

Retrieving more than one item

https://www.i-dcc.org/imits/mi_attempts.json?mi_date_lteq=2011-01-01&mi_date_gteq=2010-06-01&es_cell_name_in[]=EPD0127_4_E01&es_cell_name_in[]=EPD0343_1_H06

The above returns all MI attempts done in the INCLUSIVE range of dates specified, on either the cell EPD0127_4_E01 or EPD0343_1_H06. Note the user of '[]' after the es_cell_name_in predicate as we are passing more than one value for it.

https://www.i-dcc.org/imits/mi_attempts.json?es_cell_marker_symbol_eq=Cbx7&distribution_centre_name_eq=UCD

The above returns all MI attempts done on gene Cbx7 and distribution centre UCD

Here are some examples of other predicates that are supported - note those ending with [] can be supplied multiple times:

  • es_cell_name_eq - equals
  • es_cell_name_not_eq_any[] - does not equal any in list
  • es_cell_name_cont - contains
  • es_cell_name_in[] - is one of list
  • es_cell_name_not_in[] - is not one of list
  • total_pups_born_gt - is greater than
  • total_pups_born_gteq - is greater than or equal to
  • total_pups_born_lt - is less than
  • total_pups_born_lteq - is less than or equal to
  • is_active_true - is true
  • is_active_false - is false

Pagination

Please note that data being sent out from the REST API is paginated to 25 entries per page by default. You can navigate through the pages of data by sending in a 'page' attribute (and a number value) along with the rest of your search parameters. If you would like to increase the number of results retrieved per page, just send in the 'per_page' parameter (and a number value) in addition to your other search parameters.

e.g.

https://www.i-dcc.org/imits/mi_attempts.json?per_page=20&page=2