Skip to content

Instantly share code, notes, and snippets.

@j1n3l0
Created April 14, 2010 23:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save j1n3l0/366469 to your computer and use it in GitHub Desktop.
Save j1n3l0/366469 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use REST::Client;
use Data::Dumper;
use JSON;
my $client =
REST::Client->new( { host => 'http://username:password@localhost:3000' } );
# Add header "Content-Type"
$client->addHeader( content_type => 'application/json' );
# Get allele lists - first page
$client->GET('alleles.json?page=1');
print Dumper from_json( $client->responseContent );
# Get allele id 1 - no need to keep track of the ids
# a search method is provided, see extended example.
$client->GET('alleles/1.json');
print Dumper from_json( $client->responseContent );
# Create an allele
my %data = (
molecular_structure => {
pipeline_id => 1,
mgi_accession_id => "MGI:44556",
project_design_id => 10000,
cassette => "L1L2_gt2",
backbone => "L3L4_pZero_kan",
assembly => "NCBIM37",
chromosome => "11",
strand => "+",
design_type => "Knock Out",
design_subtype => "Frameshift",
homology_arm_start => 10,
homology_arm_end => 10000,
cassette_start => 50,
cassette_end => 500,
loxp_start => 600,
loxp_end => 700
},
);
$client->POST( 'alleles.json', to_json( \%data ) );
print Dumper from_json( $client->responseContent );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment