Skip to content

Using the Web Services: curl

pm9-sanger edited this page Jan 3, 2017 · 6 revisions

Using 'curl' on the command-line to manipulate the REST API

In the below examples, 'user@sanger.ac.uk' is used to log into the system. It is a fictional account, and should be replaced with a valid Imits user account. The password will always be 'password' on the labs system, unless it is changed after logging in (not recommended).

Searching

$ curl --globoff --basic --user user@sanger.ac.uk:password \
       -X GET 'https://www.i-dcc.org/imits/mi_attempts.json?mi_date_lt=2012-01-01&mi_date_gt=2009-10-01&production_centre_name_in[]=WTSI&production_centre_name_in[]=ICS'

The above example searches all mi_attempts in the system that have an 'mi_date' between 1st. October 2009 and 1st. January 2012 (exclusive range), and a production centre of either WTSI or ICS.

Example return value:

[
    {
        "colony_name": "ICS-HEPD0527_4_D08-1",
        "comments": null,
        "date_chimeras_mated": "2011-01-13",
        "id": 2787,
        "is_active": true,
        "is_emma_sticky": false,
        "is_released_from_genotyping": false,
        "is_suitable_for_emma": true,
        "mi_date": "2010-10-26",
        "mi_plan_id": 1864,
        "mouse_allele_type": null,
        "number_of_cct_offspring": null,
        "number_of_chimera_matings_attempted": 2,
        "number_of_chimera_matings_successful": 2,
        "number_of_chimeras_with_0_to_9_percent_glt": 0,
        "number_of_chimeras_with_100_percent_glt": 0,
        "number_of_chimeras_with_10_to_49_percent_glt": 0,
        "number_of_chimeras_with_50_to_99_percent_glt": 0,
        "number_of_chimeras_with_glt_from_cct": 0,
        "number_of_chimeras_with_glt_from_genotyping": 2,
        "number_of_het_offspring": 5,
        "number_of_live_glt_offspring": 5,
        "number_of_males_with_0_to_39_percent_chimerism": 0,
        "number_of_males_with_100_percent_chimerism": 0,
        "number_of_males_with_40_to_79_percent_chimerism": 0,
        "number_of_males_with_80_to_99_percent_chimerism": 2,
        "number_surrogates_receiving": 3,
        "report_to_public": true,
        "total_blasts_injected": 84,
        "total_chimeras": 3,
        "total_f1_mice_from_matings": 0,
        "total_female_chimeras": 1,
        "total_male_chimeras": 2,
        "total_pups_born": 3,
        "total_transferred": 84,
        "es_cell_name": "HEPD0527_4_D08",
        "emma_status": "suitable",
        "status": "Genotype confirmed",
        "blast_strain_name": "BALB/cN",
        "colony_background_strain_name": "C57BL/6N",
        "test_cross_strain_name": "C57BL/6N",
        "distribution_centre_name": "ICS",
        "production_centre_name": "ICS",
        "consortium_name": "EUCOMM-EUMODIC",
        "mouse_allele_symbol": null,
        "deposited_material_name": "Frozen embryos",
        "es_cell_marker_symbol": "Fkbp9",
        "es_cell_allele_symbol": "Fkbp9<sup>tm1a(EUCOMM)Hmgu</sup>",
        "qc_southern_blot_result": "pass",
        "qc_five_prime_lr_pcr_result": "na",
        "qc_five_prime_cassette_integrity_result": "na",
        "qc_tv_backbone_assay_result": "na",
        "qc_neo_count_qpcr_result": "na",
        "qc_neo_sr_pcr_result": "na",
        "qc_loa_qpcr_result": "na",
        "qc_homozygous_loa_sr_pcr_result": "na",
        "qc_lacz_sr_pcr_result": "na",
        "qc_mutant_specific_sr_pcr_result": "na",
        "qc_loxp_confirmation_result": "na",
        "qc_three_prime_lr_pcr_result": "na"
    },
    {
        "colony_name": "ICS-HEPD0527_2_D03-1",
        "comments": null,
        "date_chimeras_mated": "2011-02-17",
        "id": 2833,
        "is_active": true,
        "is_emma_sticky": false,
        "is_released_from_genotyping": false,
        "is_suitable_for_emma": true,
        "mi_date": "2010-12-01",
        "mi_plan_id": 1890,
        "mouse_allele_type": null,
        "number_of_cct_offspring": null,
        "number_of_chimera_matings_attempted": 8,
        "number_of_chimera_matings_successful": 0,
        "number_of_chimeras_with_0_to_9_percent_glt": 0,
        "number_of_chimeras_with_100_percent_glt": 0,
        "number_of_chimeras_with_10_to_49_percent_glt": 0,
        "number_of_chimeras_with_50_to_99_percent_glt": 0,
        "number_of_chimeras_with_glt_from_cct": 0,
        "number_of_chimeras_with_glt_from_genotyping": 0,
        "number_of_het_offspring": 10,
        "number_of_live_glt_offspring": 10,
        "number_of_males_with_0_to_39_percent_chimerism": 1,
        "number_of_males_with_100_percent_chimerism": 1,
        "number_of_males_with_40_to_79_percent_chimerism": 7,
        "number_of_males_with_80_to_99_percent_chimerism": 4,
        "number_surrogates_receiving": 6,
        "report_to_public": true,
        "total_blasts_injected": 84,
        "total_chimeras": 17,
        "total_f1_mice_from_matings": 0,
        "total_female_chimeras": 4,
        "total_male_chimeras": 13,
        "total_pups_born": 30,
        "total_transferred": 84,
        "es_cell_name": "HEPD0527_2_D03",
        "emma_status": "suitable",
        "status": "Genotype confirmed",
        "blast_strain_name": "BALB/cN",
        "colony_background_strain_name": "C57BL/6N",
        "test_cross_strain_name": "C57BL/6N",
        "distribution_centre_name": "ICS",
        "production_centre_name": "ICS",
        "consortium_name": "EUCOMM-EUMODIC",
        "mouse_allele_symbol": null,
        "deposited_material_name": "Frozen embryos",
        "es_cell_marker_symbol": "Pla2g4f",
        "es_cell_allele_symbol": "Pla2g4f<sup>tm1a(EUCOMM)Hmgu</sup>",
        "qc_southern_blot_result": "pass",
        "qc_five_prime_lr_pcr_result": "na",
        "qc_five_prime_cassette_integrity_result": "na",
        "qc_tv_backbone_assay_result": "na",
        "qc_neo_count_qpcr_result": "na",
        "qc_neo_sr_pcr_result": "na",
        "qc_loa_qpcr_result": "na",
        "qc_homozygous_loa_sr_pcr_result": "na",
        "qc_lacz_sr_pcr_result": "na",
        "qc_mutant_specific_sr_pcr_result": "na",
        "qc_loxp_confirmation_result": "pass",
        "qc_three_prime_lr_pcr_result": "na"
    }
]

Getting back an individual mi_attempt by ID

$ curl --globoff -i --basic --user user@sanger.ac.uk:password -X GET 'https://www.i-dcc.org/imits/mi_attempts/2787.json'

Example return value:

{
    "colony_name": "ICS-HEPD0527_4_D08-1",
    "comments": null,
    "date_chimeras_mated": "2011-01-13",
    "id": 2787,
    "is_active": true,
    "is_emma_sticky": false,
    "is_released_from_genotyping": false,
    "is_suitable_for_emma": true,
    "mi_date": "2010-10-26",
    "mi_plan_id": 1864,
    "mouse_allele_type": null,
    "number_of_cct_offspring": null,
    "number_of_chimera_matings_attempted": 2,
    "number_of_chimera_matings_successful": 2,
    "number_of_chimeras_with_0_to_9_percent_glt": 0,
    "number_of_chimeras_with_100_percent_glt": 0,
    "number_of_chimeras_with_10_to_49_percent_glt": 0,
    "number_of_chimeras_with_50_to_99_percent_glt": 0,
    "number_of_chimeras_with_glt_from_cct": 0,
    "number_of_chimeras_with_glt_from_genotyping": 2,
    "number_of_het_offspring": 5,
    "number_of_live_glt_offspring": 5,
    "number_of_males_with_0_to_39_percent_chimerism": 0,
    "number_of_males_with_100_percent_chimerism": 0,
    "number_of_males_with_40_to_79_percent_chimerism": 0,
    "number_of_males_with_80_to_99_percent_chimerism": 2,
    "number_surrogates_receiving": 3,
    "report_to_public": true,
    "total_blasts_injected": 84,
    "total_chimeras": 3,
    "total_f1_mice_from_matings": 0,
    "total_female_chimeras": 1,
    "total_male_chimeras": 2,
    "total_pups_born": 3,
    "total_transferred": 84,
    "es_cell_name": "HEPD0527_4_D08",
    "emma_status": "suitable",
    "status": "Genotype confirmed",
    "blast_strain_name": "BALB/cN",
    "colony_background_strain_name": "C57BL/6N",
    "test_cross_strain_name": "C57BL/6N",
    "distribution_centre_name": "ICS",
    "production_centre_name": "ICS",
    "consortium_name": "EUCOMM-EUMODIC",
    "mouse_allele_symbol": null,
    "deposited_material_name": "Frozen embryos",
    "es_cell_marker_symbol": "Fkbp9",
    "es_cell_allele_symbol": "Fkbp9<sup>tm1a(EUCOMM)Hmgu</sup>",
    "qc_southern_blot_result": "pass",
    "qc_five_prime_lr_pcr_result": "na",
    "qc_five_prime_cassette_integrity_result": "na",
    "qc_tv_backbone_assay_result": "na",
    "qc_neo_count_qpcr_result": "na",
    "qc_neo_sr_pcr_result": "na",
    "qc_loa_qpcr_result": "na",
    "qc_homozygous_loa_sr_pcr_result": "na",
    "qc_lacz_sr_pcr_result": "na",
    "qc_mutant_specific_sr_pcr_result": "na",
    "qc_loxp_confirmation_result": "na",
    "qc_three_prime_lr_pcr_result": "na"
}

Updating an mi_attempt

The ID of the mi_attempt is needed before an update can be performed.

$ curl --globoff --basic --user user@sanger.ac.uk:password -X PUT -H 'Content-Type: application/json' --data-binary '{"mi_attempt": {"number_surrogates_receiving": 10}}' 'https://www.i-dcc.org/imits/mi_attempts/2787.json'

Validate response by checking that HTTP header 'Status' in response begins with '2':

HTTP/1.0 200 OK
...
Status: 200
...

Creating an mi_attempt

This one aspect has changed significantly since April 30th. See the cut-paste-example in the next section.

Creating and Updating Es Cell QC data

See the cut-paste-example in the next section.