Skip to content
David E. Wheeler edited this page Feb 24, 2019 · 6 revisions

User List API

  • Name: userlist
  • Returns: application/json
  • URI Template Variables: {letter}
  • Availability: API Server

Returns JSON describing listing all users whose nicknames begin with the lowercase ASCII letter specified via the {letter} URI template variable. All PGXN usernames must start with such a letter, so it's possible to iterate over all 26 letters to get a complete list of users. If no users exist with nicknames beginning with the specified letter, a 404 will be returned.

Structure

The JSON returned will be a single array. The users are listed in the array in alphabetical order by nickname. Each one is represented by a JSON objet with two keys:

Key Type Description
user String The nickname of the user.
name String The full name of the user.

More information about a user can be fetched by passing the name value to the user API's {user} URI template variable.

Example:

[
   {
      "name": "Alexey Klyukin",
      "user": "alexk"
   },
   {
      "name": "Álvaro Herrera",
      "user": "alvherre"
   },
   {
      "name": "Andrew Dunstan",
      "user": "andrew"
   },
   {
      "name": "Marcel Asio",
      "user": "asio"
   }
]

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 JSON listing all users whose nicknames start with "a" like so:

use URI::Template;
use HTTP::Tiny;
use JSON;
my $tmpl = URI::Template->new($table->{userlist});
my $uri = $tmpl->process({ letter => 'a' });

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