The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Net::API::CPAN::Mock - Meta CPAN API

SYNOPSIS

    use Net::API::CPAN::Mock;
    my $this = Net::API::CPAN::Mock->new(
        pretty => 1,
        openapi => '/path/to/cpan-openapi-specs.json',
    ) || die( Net::API::CPAN::Mock->error, "\n" );
    $mock->bind || die( $mock->error );
    $mock->start || die( $mock->error );
    my $url = $mock->url_base;
    # perform tests by connecting to the mock MetaCPAN API at $url
    $mock->stop;

VERSION

    v0.1.0

DESCRIPTION

This provides a mock MetaCPAN API server based on the original mock server idea in Test::HTTP::MockServer

It emulates all the known endpoints of the CPAN API, and endeavours to mimic its responses.

It provides sample data for all endpoints. Those data are based on real CPAN modules, but have been completely anonymised using fake names and fake e-mail addresses.

CONSTRUCTOR

new

This instantiates a new Net::API::CPAN::Mock object. It accepts the following options as an hash or hash reference.

It returns the new object upon success, or upon error, sets an error and returns undef in scalar context, or an empty list in list context.

  • checksum

    OpenAPI specifications file checksum for caching. This is set automatically by load_specs

  • endpoints

    OpenAPI resulting endpoints we derived from the specs

  • host

    The host to use when starting the mock CPAN API server.

  • openapi

    This is the filepath to the OpenAPI specifications file.

  • port

    The port to use when starting the mock CPAN API server.

  • pretty

    Boolean. If true, the JSON data returned by the mock server will be in a human-readable format.

  • schema

    The OpenAPI resulting schema we derived from the specs.

METHODS

bind

This creates a socket, and binds it to the host and port

If none provided, the host is set to 127.0.0.1and the port is randomly generated.

Once done, it sets the host and port and socket values to be accessible with their respective method.

It returns the current object upon success, or, upon error, sets an error and returns undef in scalar context, or an empty list in list context.

data

    my $data = $self->data;

Read-only. This returns the test data as an hash reference. The test data are stored in $Net::API::CPAN::Mock::TEST_DATA

endpoints

Sets or gets the hash reference of endpoints derived from the specs analysed in load_specs

This returns an hash object, or undef if nothing was set yet.

host

When used as a mutator, i.e. setting a value, this sets the host to use when starting the server.

In accessor mode, this ensures the socket is bound to the specified host and port.

By default, the value used is 127.0.0.1

This returns the current host value.

json

Sets or gets the JSON object.

load_specs

This takes a file path to an OpenAPI specifications, and will load its enclosed endpoints, schema and all specifications that will be used to run the mock CPAN API server.

The result is cached, so it can be re-called safely. If the OpenAPI specifications have been changed, the next call to load_specs will have it re-load the file.

It sets the value for specs, sets the MD5 checksum for the OpenAPI specifications file, and the hash reference of endpoints.

It returns the current object upon success, or, upon error, sets an error and returns undef in scalar context, or an empty list in list context.

pid

Sets or gets the process ID for this mock CPAN API server.

Returns a regular number or undef if nothing was set yet.

port

When used as a mutator, i.e. setting a value, this sets the port to use when starting the server.

In accessor mode, this ensures the socket is bound to the specified host and port.

By default, the value used is a random integer.

This returns the current host value.

pretty

    $mock->pretty(1);
    my $bool = $mock->pretty;

Sets or gets the boolean value of whether the JSON data returned by the mock server will be in a human-readable format.

Defaults to false.

socket

Sets or gets the server socket value.

Returns an IO::Socket filehandle when set, or undef otherwise.

specs

The OpenAPI JSON specifications as perl hash reference. This is set upon loading by load_specs

start

Starts the mock CPAN API server, forks and returns the current object upon success, or, upon error, sets an error and returns undef in scalar context, or an empty list in list context.

The child process whose pid can be accessed with "pid" in pid goes on waiting for connections.

stop

Stop the mock CPAN API server, and returns the killed process pid

url_base

    my $uri = $mock->url_base; # http://127.0.0.1:1234

Read-only. Based on the host and port set, this returns an URI object representing the base HTTP URI for all endpoints.

ENDPOINTS

The following are the endpoints supported by MetaCPAN REST API:

  • /v1/author

        curl https://fastapi.metacpan.org/v1/author?q=OALDERS
        curl -XPOST https://fastapi.metacpan.org/v1/author -H 'Content-Type: application/json; charset=utf-8' --data-binary \@- <<EOT
        {
            "query": { "filtered": {
                "query": { "match_all":{} },
                "filter": {
                    "and": [
                        { "term": { "pauseid": "OALDERS" } }
                    ]
                }
            }}
        }
        EOT

    GET or POST retrieves authors information details using a simple search

  • /v1/author/_mapping

        curl https://fastapi.metacpan.org/v1/author/_mapping
        curl -XPOST https://fastapi.metacpan.org/v1/author/_mapping

    GET or POST returns the available fields for the author object

  • /v1/author/_search

        curl https://fastapi.metacpan.org/v1/author/_search?from=10&q=Tokyo&size=10
        curl -XPOST https://fastapi.metacpan.org/v1/author/_search -H 'Content-Type: application/json; charset=utf-8' --data-binary @- <<EOT
        {
           "query" : {
              "filtered" : {
                 "filter" : {
                    "and" : [
                       {
                          "term" : {
                             "city" : "Tokyo"
                          }
                       }
                    ]
                 },
                 "query" : {
                    "match_all" : {}
                 }
              }
           }
        }
        EOT

    GET or POST returns the result set for the author search

  • /v1/author/_search/scroll

    GET or POST returns the result set for the author search and DELETE clear a scroll

  • /v1/author/by_ids

        curl https://fastapi.metacpan.org/v1/author/by_ids?id=OALDERS&id=JDEGUEST
        curl -XPOST https://fastapi.metacpan.org/v1/author/by_ids -H 'Content-Type: application/json; charset=utf-8' -d '{"id" : ["OALDERS", "JDEGUEST"]}'

    GET or POST retrieves author information details for the specified pause IDs

  • /v1/author/by_prefix/{prefix}

        curl https://fastapi.metacpan.org/v1/author/by_prefix/OAL
        curl -XPOST https://fastapi.metacpan.org/v1/author/by_prefix/O?from=40&size=20'

    GET or POST retrieves authors information details using the initial characters of their pause ID

  • /v1/author/by_user

        curl https://fastapi.metacpan.org/v1/author/by_user?user=oa-cmsLWTTOALauLxve1LA&user=2n2yGvQ4QxenVpSzkkTitQ
        curl -XPOST https://fastapi.metacpan.org/v1/author/by_user -H 'Content-Type: application/json; charset=utf-8' --data-binary @- <<EOT
        {
           "user" : [
              "oa-cmsLWTTOALauLxve1LA",
              "2n2yGvQ4QxenVpSzkkTitQ"
           ]
        }
        EOT

    GET or POST retrieves authors information details using their user ID

  • /v1/author/by_user/{user}

        curl https://fastapi.metacpan.org/v1/author/by_user/FepgBJBZQ8u92eG_TcyIGQ
        curl -XPOST https://fastapi.metacpan.org/v1/author/by_user/FepgBJBZQ8u92eG_TcyIGQ

    GET or POST retrieves a author information details using his or her user ID

  • /v1/author/{author}

        curl https://fastapi.metacpan.org/v1/author/OALDERS?join=release
        curl -XPOST https://fastapi.metacpan.org/v1/author/OALDERS

    GET or POST retrieves an author information details

  • /v1/changes/by_releases

        curl https://fastapi.metacpan.org/v1/changes/by_releases?release=OALDERS%2FHTTP-Message-6.37&release=JDEGUEST%2FModule-Generic-v0.30.1
        curl -XPOST https://fastapi.metacpan.org/v1/changes/by_releases -H 'Content-Type: application/json; charset=utf-8' --data-binary @- <<EOT
        {
           "release" : [
              "OALDERS/HTTP-Message-6.37",
              "JDEGUEST/Module-Generic-v0.30.1"
           ]
        }
        EOT

    GET or POST retrieves one or more distribution Changes file details using author and release information

  • /v1/changes/{author}/{release}

        curl https://fastapi.metacpan.org/v1/changes/OALDERS/HTTP-Message-6.36
        curl -XPOST https://fastapi.metacpan.org/v1/changes/OALDERS/HTTP-Message-6.36

    GET or POST retrieves a Changes file details based on the specified release

  • /v1/changes/{distribution}

        curl https://fastapi.metacpan.org/v1/changes/HTTP-Message
        curl -XPOST https://fastapi.metacpan.org/v1/changes/HTTP-Message

    GET or POST retrieves a Changes file details based on the latest release of the specified distribution

  • /v1/contributor/_mapping

        curl https://fastapi.metacpan.org/v1/contributor/_mapping
        curl -XPOST https://fastapi.metacpan.org/v1/contributor/_mapping

    GET or POST returns the available fields for the contributor object

  • /v1/contributor/by_pauseid/{author}

        curl https://fastapi.metacpan.org/v1/contributor/by_pauseid/OALDERS
        curl -XPOST https://fastapi.metacpan.org/v1/contributor/by_pauseid/OALDERS

    GET or POST retrieves a list of module contributed to by the specified Pause ID

  • /v1/contributor/{author}/{release}

        curl https://fastapi.metacpan.org/v1/contributor/OALDERS/HTTP-Message-6.37
        curl -XPOST https://fastapi.metacpan.org/v1/contributor/OALDERS/HTTP-Message-6.37

    GET or POST retrieves a list of release contributors details

  • /v1/cover/{release}

        curl https://fastapi.metacpan.org/v1/cover/HTTP-Message-6.37
        curl -XPOST https://fastapi.metacpan.org/v1/cover/HTTP-Message-6.37

    GET or POST retrieves a module cover details

  • /v1/cve

        curl https://fastapi.metacpan.org/v1/cve
        curl -XPOST https://fastapi.metacpan.org/v1/cve

    GET or POST retrieves CVE (Common Vulnerabilities & Exposures) information details

  • /v1/cve/dist/{distribution}

        curl https://fastapi.metacpan.org/v1/cve/dist/HTTP-Message
        curl -XPOST https://fastapi.metacpan.org/v1/cve/dist/HTTP-Message

    GET or POST retrieves Distribution CVE (Common Vulnerabilities & Exposures) information details

  • /v1/cve/release/{author}/{release}

        curl https://fastapi.metacpan.org/v1/cve/release/OALDERS/HTTP-Message-6.36
        curl -XPOST https://fastapi.metacpan.org/v1/cve/release/OALDERS/HTTP-Message-6.36

    GET or POST retrieves Release CVE (Common Vulnerabilities & Exposures) information details

  • /v1/cve/{cpanid}

        curl https://fastapi.metacpan.org/v1/cve/OALDERS
        curl -XPOST https://fastapi.metacpan.org/v1/cve/OALDERS

    GET or POST retrieves CPAN ID CVE (Common Vulnerabilities & Exposures) information details

  • /v1/diff/file/{file1}/{file2}

        curl https://fastapi.metacpan.org/v1/diff/file/AcREzFgg3ExIrFTURa0QJfn8nto/Ies7Ysw0GjCxUU6Wj_WzI9s8ysU
        curl -XPOST https://fastapi.metacpan.org/v1/diff/file/AcREzFgg3ExIrFTURa0QJfn8nto/Ies7Ysw0GjCxUU6Wj_WzI9s8ysU

    GET or POST retrieves a diff of two files

  • /v1/diff/release/{author1}/{release1}/{author2}/{release2}

        curl https://fastapi.metacpan.org/v1/diff/release/OALDERS/HTTP-Message-6.35/OALDERS/HTTP-Message-6.36
        curl -XPOST https://fastapi.metacpan.org/v1/diff/release/OALDERS/HTTP-Message-6.35/OALDERS/HTTP-Message-6.36

    GET or POST retrieves a diff of two releases

  • /v1/diff/release/{distribution}

        curl https://fastapi.metacpan.org/v1/diff/release/HTTP-Message
        curl -XPOST https://fastapi.metacpan.org/v1/diff/release/HTTP-Message

    GET or POST retrieves a diff of the latest release and its previous version

  • /v1/distribution

        curl https://fastapi.metacpan.org/v1/distribution?from=10&q=HTTP&size=10
        curl -XPOST https://fastapi.metacpan.org/v1/distribution -H 'Content-Type: application/json; charset=utf-8' --data-binary @- <<EOT
        {
           "query" : {
              "regexp" : {
                 "name" : "HTTP.*"
              }
           }
        }
        EOT

    GET or POST retrieves distributions information details

  • /v1/distribution/_mapping

        curl https://fastapi.metacpan.org/v1/distribution/_mapping
        curl -XPOST https://fastapi.metacpan.org/v1/distribution/_mapping

    GET or POST returns the available fields for the distribution object

  • /v1/distribution/_search

        curl https://fastapi.metacpan.org/v1/distribution/_search?q=HTTP.*&size=10
        curl -XPOST https://fastapi.metacpan.org/v1/distribution/_search -H 'Content-Type: application/json; charset=utf-8' --data-binary @- <<EOT
        {
           "query" : {
              "regexp" : {
                 "name" : "HTTP.*"
              }
           }
        }
        EOT

    GET or POST returns the result set for the distribution search

  • /v1/distribution/_search/scroll

    GET or POST returns the result set for the scroll search and DELETE clear a scroll

  • /v1/distribution/river

        curl https://fastapi.metacpan.org/v1/distribution/river?distribution=HTTP-Message&distribution=Module-Generic
        curl -XPOST https://fastapi.metacpan.org/v1/distribution/river -H 'Content-Type: application/json; charset=utf-8' --data-binary @- <<EOT
        {
           "distribution" : [
              "HTTP-Message",
              "Module-Generic"
           ]
        }
        EOT

    GET or POST returns the river of specified distributions

  • /v1/distribution/river/{distribution}

        curl https://fastapi.metacpan.org/v1/distribution/river/HTTP-Message
        curl -XPOST https://fastapi.metacpan.org/v1/distribution/river/HTTP-Message

    GET or POST returns the river of a specific distribution

  • /v1/distribution/{distribution}

        curl https://fastapi.metacpan.org/v1/distribution/HTTP-Message
        curl -XPOST https://fastapi.metacpan.org/v1/distribution/HTTP-Message

    GET or POST retrieves the specified distribution latest release information

  • /v1/download_url/{module}

        curl https://fastapi.metacpan.org/v1/download_url/HTTP::Message
        curl -XPOST https://fastapi.metacpan.org/v1/download_url/HTTP::Message

    GET or POST retrieves a download URL for a given module. The /download_url endpoint exists specifically for the cpanm client. It takes a module name with an optional version (or range of versions) and an optional dev flag (for development releases) and returns a download_url as well as some other helpful info.

    Obviously anyone can use this endpoint, but we'll only consider changes to this endpoint after considering how cpanm might be affected

  • /v1/favorite

        curl https://fastapi.metacpan.org/v1/favorite?q=HTTP&size=10
        curl -XPOST https://fastapi.metacpan.org/v1/favorite -H 'Content-Type: application/json; charset=utf-8' --data-binary @- <<EOT
        {
           "query" : {
              "regexp" : {
                 "release" : "HTTP.*"
              }
           }
        }
        EOT

    GET or POST retrieves favorites information details

  • /v1/favorite/_mapping

    GET or POST returns the available fields for the favorite object

  • /v1/favorite/_search

        curl https://fastapi.metacpan.org/v1/favorite/_search?from=40&q=HTTP&size=20
        curl -XPOST https://fastapi.metacpan.org/v1/favorite/_search -H 'Content-Type: application/json; charset=utf-8' --data-binary @- <<EOT
        {
           "from" : 40,
           "query" : {
              "regexp" : {
                 "distribution" : "HTTP.*"
              }
           },
           "size" : 20
        }
        EOT

    GET or POST returns the result set for the favorite search

  • /v1/favorite/_search/scroll

    GET or POST returns the result set for the favorite search and DELETE clear a scroll

  • /v1/favorite/agg_by_distributions

        curl https://fastapi.metacpan.org/v1/favorite/agg_by_distributions?distribution=HTTP-Message&distribution=DBI
        curl -XPOST https://fastapi.metacpan.org/v1/favorite/agg_by_distributions -H 'Content-Type: application/json; charset=utf-8' --data-binary @- <<EOT
        {
           "distribution" : [
              "HTTP-Message",
              "DBI"
           ]
        }
        EOT

    GET or POST retrieves favorites agregate by distributions

  • /v1/favorite/by_user/{user}

        curl https://fastapi.metacpan.org/v1/favorite/by_user/q_15sjOkRminDY93g9DuZQ
        curl -XPOST https://fastapi.metacpan.org/v1/favorite/by_user/q_15sjOkRminDY93g9DuZQ

    GET or POST retrieves user favorites information details

  • /v1/favorite/leaderboard

        curl https://fastapi.metacpan.org/v1/favorite/leaderboard
        curl -XPOST https://fastapi.metacpan.org/v1/favorite/leaderboard

    GET or POST retrieves top favorite distributions (leaderboard)

  • /v1/favorite/recent

        curl https://fastapi.metacpan.org/v1/favorite/recent?page=10&size=10
        curl -XPOST https://fastapi.metacpan.org/v1/favorite/recent -H 'Content-Type: application/json; charset=utf-8' --data-binary @- <<EOT
        {
           "page" : 10,
           "size" : 10
        }
        EOT

    GET or POST retrieves list of recent favorite distributions

  • /v1/favorite/users_by_distribution/{distribution}

        curl https://fastapi.metacpan.org/v1/favorite/users_by_distribution/HTTP-Message
        curl -XPOST https://fastapi.metacpan.org/v1/favorite/users_by_distribution/HTTP-Message

    GET or POST retrieves list of users who favorited a distribution

  • /v1/favorite/{user}/{distribution}

        curl https://fastapi.metacpan.org/v1/favorite/q_15sjOkRminDY93g9DuZQ/DBI
        curl -XPOST https://fastapi.metacpan.org/v1/favorite/q_15sjOkRminDY93g9DuZQ/DBI

    GET or POST retrieves favorites information details for a specific distribution

  • /v1/file

        curl https://fastapi.metacpan.org/v1/file?from=40&q=HTTP&size=20
        curl -XPOST https://fastapi.metacpan.org/v1/file -H 'Content-Type: application/json; charset=utf-8' --data-binary @- <<EOT
        {
           "from" : 40,
           "query" : {
              "regexp" : {
                 "release" : "HTTP.*"
              }
           },
           "size" : 20
        }
        EOT

    GET or POST queries files information details using simple search

  • /v1/file/_mapping

    GET or POST returns the available fields for the file object

  • /v1/file/_search

        curl https://fastapi.metacpan.org/v1/file/_search?from=40&q=HTTP&size=20
        curl -XPOST https://fastapi.metacpan.org/v1/file/_search -H 'Content-Type: application/json; charset=utf-8' --data-binary @- <<EOT
        {
           "from" : 40,
           "query" : {
              "regexp" : {
                 "path" : ".*HTTP.*"
              }
           },
           "size" : 20
        }
        EOT

    GET or POST returns the result set for the file search

  • /v1/file/_search/scroll

    GET or POST returns the result set for the file search and DELETE clear a scroll

  • /v1/file/dir/{path}

        curl https://fastapi.metacpan.org/v1/file/dir/OALDERS/HTTP-Message-6.36/lib/HTTP
        curl -XPOST https://fastapi.metacpan.org/v1/file/dir/OALDERS/HTTP-Message-6.36/lib/HTTP

    GET or POST retrieves a specific release directory content

  • /v1/file/{author}/{release}/{path}

        curl https://fastapi.metacpan.org/v1/file/OALDERS/HTTP-Message-6.36/lib/HTTP/Message.pm
        curl -XPOST https://fastapi.metacpan.org/v1/file/OALDERS/HTTP-Message-6.36/lib/HTTP/Message.pm

    GET or POST retrieves a file information details specified by its release and file path

  • /v1/login/index

        curl https://fastapi.metacpan.org/v1/login/index
        curl -XPOST https://fastapi.metacpan.org/v1/login/index

    GET or POST returns a login HTML page

  • /v1/mirror

        curl https://fastapi.metacpan.org/v1/mirror
        curl -XPOST https://fastapi.metacpan.org/v1/mirror

    GET or POST returns a mirrors object containing a list of mirror objects. Currently, the API only returns one mirror, because CPAN now uses CDN instead of mirrors

  • /v1/mirror/search

        curl https://fastapi.metacpan.org/v1/mirror/search?from=0&q=CPAN&size=20
        curl -XPOST https://fastapi.metacpan.org/v1/mirror/search -H 'Content-Type: application/json; charset=utf-8' --data-binary @- <<EOT
        {
           "from" : 0,
           "query" : {
              "regexp" : {
                 "path" : ".*HTTP.*"
              }
           },
           "size" : 20
        }
        EOT

    GET or POST returns a mirrors object containing a list of mirror objects. Currently, the API only returns one mirror, because CPAN now uses CDN instead of mirrors

  • /v1/module

        curl https://fastapi.metacpan.org/v1/module?from=40&q=HTTP&size=20
        curl -XPOST https://fastapi.metacpan.org/v1/module -H 'Content-Type: application/json; charset=utf-8' --data-binary @- <<EOT
        {
           "from" : 40,
           "query" : {
              "regexp" : {
                 "name" : "HTTP.*"
              }
           },
           "size" : 20
        }
        EOT

    GET or POST queries modules information details using simple search

  • /v1/module/_mapping

    GET or POST returns the available fields for the module object

  • /v1/module/_search

        curl https://fastapi.metacpan.org/v1/module/_search?from=40&q=HTTP&size=20
        curl -XPOST https://fastapi.metacpan.org/v1/module/_search -H 'Content-Type: application/json; charset=utf-8' --data-binary @- <<EOT
        {
           "from" : 40,
           "query" : {
              "regexp" : {
                 "path" : ".*HTTP.*"
              }
           },
           "size" : 20
        }
        EOT

    GET or POST returns the result set for the module search

  • /v1/module/_search/scroll

    GET or POST returns the result set for the module search and DELETE clear a scroll

  • /v1/module/{module}

        curl https://fastapi.metacpan.org/v1/module/HTTP::Message
        curl -XPOST https://fastapi.metacpan.org/v1/module/HTTP::Message

    GET or POST returns the corresponding file of the latest version of the module. Considering that HTTP-Message-6.37 is the latest release, the result of /module/HTTP::Message is the same as /file/OALDERS/HTTP-Message-6.37/lib/HTTP/Message.pm

  • /v1/package

        curl https://fastapi.metacpan.org/v1/package?from=40&q=HTTP&size=20
        curl -XPOST https://fastapi.metacpan.org/v1/package -H 'Content-Type: application/json; charset=utf-8' --data-binary @- <<EOT
        {
           "from" : 40,
           "query" : {
              "regexp" : {
                 "module_name" : "HTTP.*"
              }
           },
           "size" : 20
        }
        EOT

    GET or POST queries packages information details using simple search

  • /v1/package/modules/{distribution}

        curl https://fastapi.metacpan.org/v1/package/modules/HTTP-Message
        curl -XPOST https://fastapi.metacpan.org/v1/package/modules/HTTP-Message

    GET or POST retrieves the list of a distribution packages

  • /v1/package/{module}

        curl https://fastapi.metacpan.org/v1/package/HTTP::Message
        curl -XPOST https://fastapi.metacpan.org/v1/package/HTTP::Message

    GET or POST retrieves the latest release and package information for the specified module

  • /v1/permission

        curl https://fastapi.metacpan.org/v1/permission?from=40&q=HTTP&size=20
        curl -XPOST https://fastapi.metacpan.org/v1/permission -H 'Content-Type: application/json; charset=utf-8' --data-binary @- <<EOT
        {
           "from" : 40,
           "query" : {
              "regexp" : {
                 "module_name" : "HTTP.*"
              }
           },
           "size" : 20
        }
        EOT

    GET or POST queries permissions information details using simple search

  • /v1/permission/by_author/{author}

        curl https://fastapi.metacpan.org/v1/permission/by_author/OALDERS?from=40&q=HTTP&size=20
        curl -XPOST https://fastapi.metacpan.org/v1/permission/by_author/OALDERS -H 'Content-Type: application/json; charset=utf-8' --data-binary @- <<EOT
        {
           "from" : 40,
           "query" : {
              "regexp" : {
                 "module_name" : "HTTP.*"
              }
           },
           "size" : 20
        }
        EOT

    GET or POST retrieves permission information details for the specified author

  • /v1/permission/by_module

        curl https://fastapi.metacpan.org/v1/permission/by_module?module=HTTP%3A%3AMessage&module=Nice%3A%3ATry
        curl -XPOST https://fastapi.metacpan.org/v1/permission/by_module -H 'Content-Type: application/json; charset=utf-8' --data-binary @- <<EOT
        {
           "module" : [
              "HTTP::Message",
              "Nice::Try"
           ]
        }
        EOT

    GET or POST retrieves permission information details for the specified modules

  • /v1/permission/by_module/{module}

        curl https://fastapi.metacpan.org/v1/permission/by_module/HTTP::Message
        curl -XPOST https://fastapi.metacpan.org/v1/permission/by_module/HTTP::Message

    GET or POST retrieves permission information details for the specified module

  • /v1/permission/{module}

        curl https://fastapi.metacpan.org/v1/permission/HTTP::Message
        curl -XPOST https://fastapi.metacpan.org/v1/permission/HTTP::Message

    GET or POST returns the corresponding permission for the specified module

  • /v1/pod/{author}/{release}/{path}

        curl https://fastapi.metacpan.org/v1/pod/OALDERS/HTTP-Message-6.36/lib/HTTP/Message.pm?content-type=text/x-markdown
        curl -XPOST https://fastapi.metacpan.org/v1/pod/OALDERS/HTTP-Message-6.36/lib/HTTP/Message.pm?content-type=text/x-markdown

    GET or POST returns the POD of the given module in the specified release. You can change the output format by either passing a content-type query parameter (e.g. /pod/HTTP-Message?content-type=text/plain or by adding an Accept header to the HTTP request. Valid content types are:

    • text/html (default)

    • text/plain

    • text/x-pod

    • text/x-markdown

  • /v1/pod/{module}

        curl https://fastapi.metacpan.org/v1/pod/HTTP::Message?content-type=text/plain
        curl -XPOST https://fastapi.metacpan.org/v1/pod/HTTP::Message?content-type=text/plain

    GET or POST returns the POD of the given module. You can change the output format by either passing a content-type query parameter (e.g. /pod/HTTP-Message?content-type=text/plain or by adding an Accept header to the HTTP request. Valid content types are:

    • text/html (default)

    • text/plain

    • text/x-pod

    • text/x-markdown

  • /v1/pod_render

        curl https://fastapi.metacpan.org/v1/pod_render?pod=%3Dencoding+utf-8%0A%0A%3Dhead1+Hello+World%0A%0ASomething+here%0A%0A%3Doops%0A%0A%3Dcut%0A
        curl -XPOST https://fastapi.metacpan.org/v1/pod_render?pod=%3Dencoding+utf-8%0A%0A%3Dhead1+Hello+World%0A%0ASomething+here%0A%0A%3Doops%0A%0A%3Dcut%0A

    GET or POST takes some POD data and check for errors. It returns the POD provided in formatted plan text

  • /v1/rating

        curl https://fastapi.metacpan.org/v1/rating?from=40&q=HTTP&size=20
        curl -XPOST https://fastapi.metacpan.org/v1/rating -H 'Content-Type: application/json; charset=utf-8' --data-binary @- <<EOT
        {
           "from" : 40,
           "query" : {
              "regexp" : {
                 "distribution" : "HTTP.*"
              }
           },
           "size" : 20
        }
        EOT

    GET or POST queries ratings information details using simple search

  • /v1/rating/_mapping

    GET or POST returns the available fields for the rating object

  • /v1/rating/_search

        curl https://fastapi.metacpan.org/v1/rating/_search?from=40&q=HTTP&size=20
        curl -XPOST https://fastapi.metacpan.org/v1/rating/_search -H 'Content-Type: application/json; charset=utf-8' --data-binary @- <<EOT
        {
           "from" : 40,
           "query" : {
              "regexp" : {
                 "distribution" : ".*HTTP.*"
              }
           },
           "size" : 20
        }
        EOT

    GET or POST returns the result set for the rating search

  • /v1/rating/_search/scroll

    GET or POST returns the result set for the rating search and DELETE clear a scroll

  • /v1/rating/by_distributions

        curl https://fastapi.metacpan.org/v1/rating/by_distributions?distribution=HTTP-Tiny
        curl -XPOST https://fastapi.metacpan.org/v1/rating/by_distributions -H 'Content-Type: application/json; charset=utf-8' --data-binary @- <<EOT
        {
           "distribution" : "HTTP-Tiny"
        }

    GET or POST retrieves rating informations details for the specified distributions

  • /v1/release

        curl https://fastapi.metacpan.org/v1/release?from=40&q=HTTP&size=20
        curl -XPOST https://fastapi.metacpan.org/v1/release -H 'Content-Type: application/json; charset=utf-8' --data-binary @- <<EOT
        {
           "from" : 40,
           "query" : {
              "regexp" : {
                 "distribution" : "HTTP.*"
              }
           },
           "size" : 20
        }
        EOT

    GET or POST queries releases information details using simple search

  • /v1/release/_mapping

    GET or POST returns the available fields for the release object

  • /v1/release/_search

        curl https://fastapi.metacpan.org/v1/release/_search?from=40&q=HTTP&size=20
        curl -XPOST https://fastapi.metacpan.org/v1/release/_search -H 'Content-Type: application/json; charset=utf-8' --data-binary @- <<EOT
        {
           "from" : 40,
           "query" : {
              "regexp" : {
                 "name" : ".*HTTP.*"
              }
           },
           "size" : 20
        }
        EOT

    GET or POST returns the result set for the release search

  • /v1/release/_search/scroll

    GET or POST returns the result set for the release search and DELETE clear a scroll

  • /v1/release/all_by_author/{author}

        curl https://fastapi.metacpan.org/v1/release/all_by_author/OALDERS?page=2&page_size=100
        curl -XPOST https://fastapi.metacpan.org/v1/release/all_by_author/OALDERS?page=2&page_size=100

    GET or POST get all releases by the specified author

  • /v1/release/by_author/{author}

        curl https://fastapi.metacpan.org/v1/release/by_author/OALDERS
        curl -XPOST https://fastapi.metacpan.org/v1/release/by_author/OALDERS

    GET or POST get releases by a specified author

  • /v1/release/contributors/{author}/{release}

        curl https://fastapi.metacpan.org/v1/release/contributors/OALDERS/HTTP-Message-6.36
        curl -XPOST https://fastapi.metacpan.org/v1/release/contributors/OALDERS/HTTP-Message-6.36

    GET or POST retrieves the list of contributors for the specified release

  • /v1/release/files_by_category/{author}/{release}

        curl https://fastapi.metacpan.org/v1/release/files_by_category/OALDERS/HTTP-Message-6.36
        curl -XPOST https://fastapi.metacpan.org/v1/release/files_by_category/OALDERS/HTTP-Message-6.36

    GET or POST retrieves the list of release key files by category

  • /v1/release/interesting_files/{author}/{release}

        curl https://fastapi.metacpan.org/v1/release/interesting_files/OALDERS/HTTP-Message-6.36
        curl -XPOST https://fastapi.metacpan.org/v1/release/interesting_files/OALDERS/HTTP-Message-6.36

    GET or POST retrieves the list of interesting files for the specified release

  • /v1/release/latest_by_author/{author}

        curl https://fastapi.metacpan.org/v1/release/latest_by_author/OALDERS
        curl -XPOST https://fastapi.metacpan.org/v1/release/latest_by_author/OALDERS

    GET or POST get latest releases by the specified author

  • /v1/release/latest_by_distribution/{distribution}

        curl https://fastapi.metacpan.org/v1/release/latest_by_distribution/HTTP-Message
        curl -XPOST https://fastapi.metacpan.org/v1/release/latest_by_distribution/HTTP-Message

    GET or POST get latest releases for a specified distribution

  • /v1/release/modules/{author}/{release}

        curl https://fastapi.metacpan.org/v1/release/modules/OALDERS/HTTP-Message-6.36
        curl -XPOST https://fastapi.metacpan.org/v1/release/modules/OALDERS/HTTP-Message-6.36

    GET or POST retrieves the list of modules in the specified release

  • /v1/release/recent

        curl https://fastapi.metacpan.org/v1/release/recent
        curl -XPOST https://fastapi.metacpan.org/v1/release/recent

    GET or POST get recent releases

  • /v1/release/top_uploaders

        curl https://fastapi.metacpan.org/v1/release/top_uploaders
        curl -XPOST https://fastapi.metacpan.org/v1/release/top_uploaders

    GET or POST get top release uploaders

  • /v1/release/versions/{distribution}

        curl https://fastapi.metacpan.org/v1/release/versions/HTTP-Message
        curl -XPOST https://fastapi.metacpan.org/v1/release/versions/HTTP-Message

    GET or POST get all releases by versions for the specified distribution

  • /v1/release/{author}/{release}

        curl https://fastapi.metacpan.org/v1/release/OALDERS/HTTP-Message-6.36
        curl -XPOST https://fastapi.metacpan.org/v1/release/OALDERS/HTTP-Message-6.36

    GET or POST retrieves a distribution release information details. This /release endpoint accepts the name of an author and the name of the release (e.g. /release/DOY/OALDERS/HTTP-Message-6.37, which returns the most recent release of the distribution

  • /v1/release/{distribution}

        curl https://fastapi.metacpan.org/v1/release/HTTP-Message
        curl -XPOST https://fastapi.metacpan.org/v1/release/HTTP-Message

    GET or POST retrieves the latest distribution release information details. The /release endpoint accepts either the name of a distribution (e.g. /release/HTTP-Message, which returns the most recent release of the distribution

  • /v1/reverse_dependencies/dist/{distribution}

        curl https://fastapi.metacpan.org/v1/reverse_dependencies/dist/HTTP-Message
        curl -XPOST https://fastapi.metacpan.org/v1/reverse_dependencies/dist/HTTP-Message

    GET or POST returns a list of all the modules who depend on the specified distribution.`

  • /v1/reverse_dependencies/module/{module}

        curl https://fastapi.metacpan.org/v1/reverse_dependencies/module/HTTP::Message
        curl -XPOST https://fastapi.metacpan.org/v1/reverse_dependencies/module/HTTP::Message

    GET or POST returns a list of all the modules who depend on the specified module

  • /v1/search

    GET or POST returns result set based on the search query

  • /v1/search/autocomplete

    GET or POST returns result set based on the autocomplete search query

  • /v1/search/autocomplete/suggest

    GET or POST returns suggested result set based on the autocomplete search query.`

  • /v1/search/first

    GET or POST perform API search and return the first result (I'm Feeling Lucky)

  • /v1/search/web

    GET or POST perform API search in the same fashion as the Web UI

  • /v1/source/{author}/{release}/{path}

        curl https://fastapi.metacpan.org/v1/source/OALDERS/HTTP-Message-6.36/lib/HTTP/Message.pm
        curl -XPOST https://fastapi.metacpan.org/v1/source/OALDERS/HTTP-Message-6.36/lib/HTTP/Message.pm

    GET or POST returns the source code of the given module path within the specified release

  • /v1/source/{module}

        curl https://fastapi.metacpan.org/v1/source/HTTP::Message
        curl -XPOST https://fastapi.metacpan.org/v1/source/HTTP::Message

    GET or POST returns the full source of the latest, authorized version of the given module

SEE ALSO

Net::API::CPAN, Net::API::CPAN::Activity, Net::API::CPAN::Author, Net::API::CPAN::Changes, Net::API::CPAN::Changes::Release, Net::API::CPAN::Contributor, Net::API::CPAN::Cover, Net::API::CPAN::Diff, Net::API::CPAN::Distribution, Net::API::CPAN::DownloadUrl, Net::API::CPAN::Exception, Net::API::CPAN::Favorite, Net::API::CPAN::File, Net::API::CPAN::Filter, Net::API::CPAN::Generic, Net::API::CPAN::List, Net::API::CPAN::Mirror, Net::API::CPAN::Mirrors, Net::API::CPAN::Module, Net::API::CPAN::Package, Net::API::CPAN::Permission, Net::API::CPAN::Rating, Net::API::CPAN::Release, Net::API::CPAN::Release::Recent, Net::API::CPAN::Release::Suggest, Net::API::CPAN::Scroll

CREDITS

Daniel Ruoso for the original Test::HTTP::MockServer

COPYRIGHT & LICENSE

Copyright(c) 2023 DEGUEST Pte. Ltd.

All rights reserved

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.