NAME
CPAN::Testers::API - REST API for CPAN Testers data
VERSION
version 0.017
SYNOPSIS
$ cpantesters-api daemon
Listening on http://*:5000
DESCRIPTION
This is a REST API on to the data contained in the CPAN Testers database. This data includes test reports, CPAN distributions, and various aggregate test reporting.
METHODS
schema
my $schema = $c->schema;
Get the schema, a CPAN::Testers::Schema object. By default, the schema is connected from the local user's config. See "connect_from_config" in CPAN::Testers::Schema for details.
startup
# Called automatically by Mojolicious
This method starts up the application, loads any plugins, sets up routes, and registers helpers.
render_error
return $c->render_error( 400 => 'Bad Request' );
return $c->render_error( 400, {
path => '/since',
message => 'Invalid date/time',
} );
Render an error in JSON like other OpenAPI errors. The first argument is the HTTP status code. The remaining arguments are a list of errors to report. Plain strings are turned into one-element hashrefs with a message
key. Hashrefs are used as-is.
The resulting JSON looks like so:
{
"errors": [
{
"path": "/",
"message": "Bad Request"
}
]
}
{
"errors": [
{
"path": "/since",
"message": "Invalid date/time"
}
]
}
CONFIG
This application can be configured by setting the MOJO_CONFIG
environment variable to the path to a configuration file. The configuration file is a Perl script containing a single hash reference, like:
# api.conf
{
broker => 'ws://127.0.0.1:5000',
}
The possible configuration keys are below:
broker
The URL to a Mercury message broker, starting with ws://
. This broker is used to forward messages to every connected user.
SEE ALSO
Mojolicious, Mojolicious::Plugin::OpenAPI, CPAN::Testers::Schema, http://github.com/cpan-testers/cpantesters-project, http://www.cpantesters.org
AUTHOR
Doug Bell <preaction@cpan.org>
CONTRIBUTOR
Breno G. de Oliveira <garu@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2016 by Doug Bell.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.