Organisation and Repository Indentification [ORI] demonstrator

The ORI has a number of scripts for interacting with the data.
These ones were developed as part of some AJAXie data-sanity web pages, but may be of general interest.

Other example uses of the ORI APIs are the main API and example_list.html

The get_* queries

These three examples use a local script to access the actual get_* scripts on the remote server. They are not making a cross domain call.

get_org: based on name (also has url & id)
get_net, based on IP numbers (also has name & id)
get_repo, based on url (also has name & id)

These three examples use features of JQuery to access the actual get_* scripts on the remote server. They are making a cross domain calls.

get_orgs: based on name (also has url & id)
get_nets: based on IP numbers (also has name & id)
get_repos: based on url (also has name & id)


The code for the local script that makes the remote call is:

#!/usr/bin/perl
use LWP::Simple qw(get);

my $host = 'http://ori.edina.ac.uk/cgi-bin';

# we need the send an initial content-type
print "Content-type: text/html\n\n";

my $p = $ENV{PATH_INFO};
$p =~ s#^/##; # using '#' as delimiter
my @q = split /\&/, $ENV{QUERY_STRING};
my %q;
foreach my $i (@q) {
  my ( $a, $b ) = split /=/, $i;
  $q{$a} = $b;
}
my $url;

if ($p =~ /org/) {
    $url = "$host/get_orgs?format=json&field=name&q=" . $q{q};
    warn "url:$url\n";
    print get($url);
  };
if ($p =~ /net/ ) {
    $url = "$host/get_nets?format=json&field=ip&q=" . $q{q};
    warn "url:$url\n";
    print get($url);
  };
if ($p =~ /repo/ ) {
    $url = "$host/get_repos?format=json&field=url&q=" . $q{q};
    warn "url:$url\n";
    print get($url);
  };

These three examples are making a cross domain calls.