Skip to content

Writing Your First Client

Andrew Yates edited this page Jun 9, 2014 · 5 revisions

Writing a REST client is easy. If you can query our ping service you can write a client to work against any endpoint. We will write a sample client in Perl to send a request to REST using HTTP::Tiny, look at the response headers from the service & also make sure that

use strict;
use warnings;
 
use HTTP::Tiny;
use JSON;
 
my $http = HTTP::Tiny->new();
 
my $server = 'http://beta.rest.ensembl.org/';
my $ext = '/vep/human/1:6524705:6524705/T/consequences';
my $response = $http->get($server.$ext, {
  headers => { 'Content-type' => 'application/json' }
});