Apigee-Edge

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

        - add helper get_all_clients

0.04  2014-09-25 21:12:53 CST
        - add URI::Split as requirements

0.03  2014-09-25 21:01:30 CST
        - add Apigee::Edge::Helper for some common subs

0.02  2014-09-24 13:37:34 CST
        - replace url /organizations/ to /o/ (actually it's the same)
        - support expand=true in get_developer_apps

0.01  2014-09-23 10:37:47 CST
        - Initial release

README.md  view on Meta::CPAN


[http://apigee.com/docs/api/apps-0](http://apigee.com/docs/api/apps-0)

### get\_app

    my $app = $apigee->get_app($app_id);

### get\_apps

    my $app_ids = $apigee->get_apps();
    my $apps = $apigee->get_apps(expand => 'true', includeCred => 'true');

### get\_apps\_by\_family

    my $app_ids = $apigee->get_apps_by_family($family);

### get\_apps\_by\_keystatus

    my $app_ids = $apigee->get_apps_by_keystatus($keystatus);

### get\_apps\_by\_type

README.md  view on Meta::CPAN


    my $app = $apigee->delete_developer_app($developer_email, $app_name);

### get\_developer\_app

    my $app = $apigee->get_developer_app($developer_email, $app_name);

### get\_developer\_apps

    my $apps = $apigee->get_developer_apps($developer_email);
    my $apps = $apigee->get_developer_apps($developer_email, { expand => 'true' });

### update\_developer\_app

    my $app = $apigee->update_developer_app($developer_email, $app_name, {
        # update part
    });

### regenerate\_developer\_app\_key

    my $app = $apigee->regenerate_developer_app_key($developer_email, $app_name, {

README.md  view on Meta::CPAN


    my $count = $apigee->get_count_of_developer_app_resource($developer_email, $app_name, $entity_name);

## API Products

[http://apigee.com/docs/api/api-products-1](http://apigee.com/docs/api/api-products-1)

### get\_api\_products

    my $products = $apigee->get_api_products();
    my $products = $apigee->get_api_products(expand => 'true');

### search\_api\_products

    my $products = $apigee->search_api_products('attributename' => 'access', 'attributevalue' => 'public');
    my $products = $apigee->search_api_products('attributename' => 'access', 'attributevalue' => 'private', expand => 'true');

### get\_api\_product

    my $product = $apigee->get_api_product($product_name);

### get\_api\_product\_details

    my $apps = $apigee->get_api_product_details(
        $product_name,
        query => 'list', entity => 'apps' # or query => 'count', entity => 'keys, apps, developers, or companies'

examples/api_products.pl  view on Meta::CPAN

#     "environments" => [ "test", "prod"],
#     # "proxies" => ["{proxy1}", "{proxy2}", ...],
#     # "quota" => "{quota}",
#     # "quotaInterval" => "{quota_interval}",
#     # "quotaTimeUnit" => "{quota_unit}",
#     "scopes" => ["user", "repos"]
# );
# say Dumper(\$product);

# say "Get API Products...";
# my $products = $apigee->get_api_products(expand => 'true');
# say Dumper(\$products);

# say "Search API Products...";
# my $products = $apigee->search_api_products('attributename' => 'access', 'attributevalue' => 'public', expand => 'true');
# say Dumper(\$products);

# say "Update API Product...";
# my $product = $apigee->update_api_product(
#     "test-product-name",
#     {
#         "approvalType" => "auto",
#         "displayName" => "TEST PRODUCT NAME 4",
#     }
# );

examples/apps.pl  view on Meta::CPAN

use Data::Dumper;

die "ENV APIGEE_ORG/APIGEE_USR/APIGEE_PWD is required." unless $ENV{APIGEE_ORG} and $ENV{APIGEE_USR} and $ENV{APIGEE_PWD};
my $apigee = Apigee::Edge->new(
    org => $ENV{APIGEE_ORG},
    usr => $ENV{APIGEE_USR},
    pwd => $ENV{APIGEE_PWD}
);

say "Get Apps...";
my $apps = $apigee->get_apps(expand => 'true', includeCred => 'true');
say Dumper(\$apps);


1;

lib/Apigee/Edge.pm  view on Meta::CPAN


L<http://apigee.com/docs/api/apps-0>

=head3 get_app

    my $app = $apigee->get_app($app_id);

=head3 get_apps

    my $app_ids = $apigee->get_apps();
    my $apps = $apigee->get_apps(expand => 'true', includeCred => 'true');

=head3 get_apps_by_family

    my $app_ids = $apigee->get_apps_by_family($family);

=head3 get_apps_by_keystatus

    my $app_ids = $apigee->get_apps_by_keystatus($keystatus);

=head3 get_apps_by_type

lib/Apigee/Edge.pm  view on Meta::CPAN


    my $app = $apigee->delete_developer_app($developer_email, $app_name);

=head3 get_developer_app

    my $app = $apigee->get_developer_app($developer_email, $app_name);

=head3 get_developer_apps

    my $apps = $apigee->get_developer_apps($developer_email);
    my $apps = $apigee->get_developer_apps($developer_email, { expand => 'true' });

=head3 update_developer_app

    my $app = $apigee->update_developer_app($developer_email, $app_name, {
        # update part
    });

=head3 regenerate_developer_app_key

    my $app = $apigee->regenerate_developer_app_key($developer_email, $app_name, {

lib/Apigee/Edge.pm  view on Meta::CPAN


    my $count = $apigee->get_count_of_developer_app_resource($developer_email, $app_name, $entity_name);

=head2 API Products

L<http://apigee.com/docs/api/api-products-1>

=head3 get_api_products

    my $products = $apigee->get_api_products();
    my $products = $apigee->get_api_products(expand => 'true');

=head3 search_api_products

    my $products = $apigee->search_api_products('attributename' => 'access', 'attributevalue' => 'public');
    my $products = $apigee->search_api_products('attributename' => 'access', 'attributevalue' => 'private', expand => 'true');

=head3 get_api_product

    my $product = $apigee->get_api_product($product_name);

=head3 get_api_product_details

    my $apps = $apigee->get_api_product_details(
        $product_name,
        query => 'list', entity => 'apps' # or query => 'count', entity => 'keys, apps, developers, or companies'

lib/Apigee/Edge/Helper.pm  view on Meta::CPAN

use Carp;
use base 'Apigee::Edge';
use URI::Split qw(uri_split);

use vars qw/$errstr/;
sub errstr { return $errstr || Apigee::Edge->errstr }

sub get_top_developer_app {
    my ($self, $email) = @_;

    my $apps = $self->get_developer_apps($email, {expand => 'true'});
    return unless ($apps and $apps->{app} and scalar(@{$apps->{app}}));

    my $my_app = $apps->{app}->[0];

    # flatten attrs into $my_app
    my %attrs = map { $_->{name} => $_->{value} } @{$my_app->{attributes}};
    $my_app = {%$my_app, %attrs};

    $my_app->{display_name} = $attrs{DisplayName} || $my_app->{name};    # shortcut

lib/Apigee/Edge/Helper.pm  view on Meta::CPAN

        $errstr = "$name has been registered. New OAuth credentials are available";
    }

    return $my_app;
}

sub get_all_clients {
    my ($self) = @_;

    my $apps = $self->get_apps(
        expand      => 'true',
        includeCred => 'true'
    ) or croak "Apigee::Edge failure: " . $self->errstr;
    my $CLIENTS = {};
    for my $app (@{$apps->{app}}) {
        next unless $app->{status} eq 'approved';
        my $consumerKey = eval {
            my $credentials = $app->{credentials};
            $credentials->[0]->{consumerKey};
        } || next;
        if (my $attrs = $app->{attributes}) {



( run in 1.087 second using v1.01-cache-2.11-cpan-5b529ec07f3 )