Apple-AppStoreConnect
view release on metacpan or search on metacpan
lib/Apple/AppStoreConnect.pm view on Meta::CPAN
openssl pkcs8 -nocrypt -in AuthKey_<key_id>.p8 -out AuthKey_<key_id>.pem
=item * C<key> : Instead of the C<.pem> file, you can pass its contents directly
as a string.
=item * C<key_id> : The ID of the App Store Connect API key created on the App Store
Connect portal (B<Users and Access> section).
=item * C<issuer> : Your API Key B<issuer ID>. Can be found at the top of the API keys
on the App Store Connect Portal (B<Users and Access> section).
=back
Optional parameters:
=over 4
=item * C<scope> : An arrayref that defines the token scope. Example entry:
C<["GET /v1/apps?filter[platform]=IOS"]>.
=item * C<timeout> : Timeout for requests in secs. Default: C<30>.
=item * C<ua> : Pass your own L<LWP::UserAgent> to customise the agent string etc.
=item * C<curl> : If true, fall back to using the C<curl> command line program.
This is useful if you have issues adding https support to L<LWP::UserAgent>, which
is the default method for the API requests.
=item * C<expiration> : Token expiration time in seconds. Tokens are cached until
there are less than 10 minutes left to expiration. Default: C<900> - the API will
not accept more than 20 minutes expiration time for most requests.
=item * C<jwt_payload> : Extra items to append to the JWT payload. Allows extending
the module to support more/newer versions of Apple APIs. For example, for the Apple
Store Server API you'd need to add:
jwt_payload => {bid => $bundle_id}
=back
=head1 METHODS
=head2 C<get>
my $res = $asc->get(
url => $url,
raw => $raw?,
params => \%query_params?
);
Fetches the requested API url, by default, it will use L<JSON> to decode it
directly to a Perl hash, unless you request C<raw> result as a string.
Requires L<LWP::UserAgent>, unless the C<curl> option was set.
If the request is not successful, it will C<die> throwing the C<< HTTP::Response->status_line >>.
=over 4
=item * C<url> : A URL to an API endpoint. Can pass the full URL, e.g. C<url =E<gt> 'https://api.appstoreconnect.apple.com/v1/apps'>,
or you can omit the part up to I<v1/> (i.e. C<url =E<gt> 'apps'>).
=item * C<params> : Any other query params that you need to pass
(see L<API documentation|https://developer.apple.com/documentation/appstoreconnectapi>).
=back
=head2 C<get_response>
my $res = $asc->get_response(
url => $url,
raw => $raw?,
params => \%query_params?
);
Same as C<get> except it returns the full L<HTTP::Response> from the API (so you
can handle bad requests yourself).
=head1 CONVENIENCE METHODS
=head2 C<jwt>
my $jwt = $asc->jwt(
iat => $iat?,
exp => $exp?
);
Returns the JSON Web Token string in case you need it. Will return a cached one
if it has more than 5 minutes until expiration and you don't explicitly pass an
C<exp> argument.
=over 4
=item * C<iat> : Specify the token creation timestamp. Default is C<time()>.
=item * C<exp> : Specify the token expiration timestamp. Passing this parameter
will force the creation of a new token. Default is C<time()+900> (or what you
specified in the constructor).
=back
=head2 C<get_apps>
my $res = $asc->get_apps(
id => $app_id?,
path => $path?,
params => \%query_params?
);
Without arguments it is similar to C<get(url=E<gt>"apps">, fetching the list of apps,
but does some extra processing to return a Perl hash with app IDs as keys and the
app attributes as values.
There are optional arguments to get details of a specific app or app resource:
=over 4
=item * C<id> : The app ID. Specifying just the id will return the details for a
single app.
( run in 1.075 second using v1.01-cache-2.11-cpan-524268b4103 )