Skip to content
David E. Wheeler edited this page Mar 23, 2017 · 7 revisions

README API

  • Name: readme
  • Returns: text/plain; charset=utf-8
  • URI Template Variables: {dist}, {version}
  • Availability: Mirror Server, API Server

Returns the contents of the README file for a distribution, if there is one. This method requires that the distribution name and version be known; these values can be retrieved from the following APIs:

Perl Example

Assuming you have retrieved the JSON document from the index API and stored the data in the $table hash, you can fetch the contents of the README file in version 1.1.0 of the "pair" distribution like so:

use URI::Template;
use HTTP::Tiny;
my $tmpl = URI::Template->new($table->{readme});
my $uri = $tmpl->process({
    dist    => 'pair',
    version => '1.1.0',
});

my $req  = HTTP::Tiny->new;
my $res  = $req->get('https://master.pgxn.org' . $uri);
say $res->{content};