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

API::Drip::Request - Perl interface to api.getdrip.com

VERSION

Version 0.05

SYNOPSIS

use API::Drip::Request;

my $drip = API::Drip::Request->new();

$drip->do_request( POST => 'subscribers', { subscribers => [ { email => 'foo@example.com', ... }] } );

DESCRIPTION

Low-level perl interface to the Drip API as specified at https://www.getdrip.com/docs/rest-api

All of the methods in this module will throw exceptions on error.

SUBROUTINES/METHODS

new()

Creates the API::Drip::Request object. See "CONFIGURATION" for accepted parameters.

Also accepts:

debugger

A codref that should accept a list of diagnostic strings and log them somewhere useful for debugging purposes. Only used when DRIP_DEBUG is true.

do_request

Accepts the following positional parameters:

HTTP Method (required)

May be 'GET', 'POST', 'DELETE', 'PATCH', etc..

Endpoint (requird)

Specifies the path of the REST enpoint you want to query. Include everything after the account ID. For example, "subscribers", "subscribers/$subscriber_id/campaign_subscriptions", etc...

Content (optional)

Perl hashref of data that will be sent along with the request.

On success, returns a Perl data structure corresponding to the data returned from the server. Some operations (DELETE), do not return any data and may return undef on success. On error, this method will die() with the HTTP::Response object.

CONFIGURATION

Configuration data may be passed in through a number of different ways, which are searched in the following order of preference:

1. As direct paramteters to new().
2. As environment variables.
3. As elments of the first YAML configuration file that is found and readable in the following locations:
1. The location specified by the DRIP_CLIENT_CONF parameter supplied to new().
2. The location specified by $ENV{DRIP_CLIENT_CONF}.
3. $ENV{HOME}/.drip.conf

The following configuration data is accepted:

  • DRIP_TOKEN (required)

    This is the user token assigned to you by drip. When you are logged in, look for "API Token" at https://www.getdrip.com/user/edit

  • DRIP_ID (required)

    This is the numeric user id assigned to you by drip. When logged in, find it in your settings under Account->General Info.

  • DRIP_URI (optional)

    This defaults to https://api.getdrip.com/v2. You probably shouldn't change this.

  • DRIP_AGENT (optional)

    Defaults to "API::Drip". Specifies the HTTP Agent header.

  • DRIP_DEBUG (optional)

    Defaults to 0. Set to a true value to enable debugging.

AUTHOR

Dan Wright, <Dan at DWright.Org>

BUGS

Please report bugs as an issue via GitHub https://github.com/dwright/API-Drip/issues.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc API::Drip::Request

You can also look for information at:

ACKNOWLEDGEMENTS

This code is written to help support my day job and is being released open source thanks to pair Networks, Inc.

LICENSE AND COPYRIGHT

Copyright 2017 Dan Wright.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 250:

You forgot a '=back' before '=head1'