$class - A client for the ORCID $name API
The new method returns a new $name API client.
new
Arguments to new:
client_id
Your ORCID client id (required).
client_secret
Your ORCID client secret (required).
sandbox
The client will talk to the ORCID sandbox API if set to 1.
1
transport
Specify the HTTP client to use. Possible values are LWP or HTTP::Tiny. Default is LWP.
Returns the ORCID client id used by the client.
Returns the ORCID client secret used by the client.
Returns 1 if the client is using the sandbox API, 0 otherwise.
0
Returns what HTTP transport the client is using.
api_url
Returns the base API url used by the client.
oauth_url
Returns the base OAuth url used by the client.
access_token
Request a new access token.
my \$token = \$client->access_token( grant_type => 'client_credentials', scope => '/read-public', );
authorize_url
Helper that returns an authorization url for 3-legged OAuth requests.
# in your web application redirect(\$client->authorize_url( show_login => 'true', scope => '/person/update', response_type => 'code', redirect_uri => 'http://your.callback/url', ));
See the /authorize and /authorized routes in the included playground application for an example.
/authorize
/authorized
record_url
Helper that returns an orcid record url.
\$client->record_url('0000-0003-4791-9455') # returns # http://orcid.org/0000-0003-4791-9455 # or # http://sandbox.orcid.org/0000-0003-4791-9455
read_public_token
Return an access token with scope /read-public. EOF
/read-public
$pod .= <<EOF if $class->can('read_limited_token');
read_limited_token
Return an access token with scope /read-limited. EOF
/read-limited
$pod .= <<EOF if $class->can('client');
client
Get details about the current client. EOF
$pod .= <<EOF if $class->can('search');
search
my \$hits = \$client->search(q => "johnson"); EOF
my $token_arg = 'token => $token'; my $orcid_arg = ', orcid => $orcid'; my $pc_arg = ", put_code => '123'"; my $pc_bulk_arg = ", put_code => ['123', '456']";
for my $op (sort keys %$ops) { my $spec = $ops->{$op}; my $sym = $op; $sym =~ s|[-/]|_|g;
my $base_args = $token_arg; $base_args .= $orcid_arg if $spec->{orcid}; if ($spec->{get} || $spec->{get_pc} || $spec->{get_pc_bulk}) { $pod .= "=head2 C<${sym}>\n\n"; if ($spec->{get} && ($spec->{get_pc} || $spec->{get_pc_bulk})) { $pod .= " my \$recs = \$client->${sym}($base_args);\n"; } elsif ($spec->{get}) { $pod .= " my \$rec = \$client->${sym}($base_args);\n"; } if ($spec->{get_pc}) { $pod .= " my \$rec = \$client->${sym}($base_args$pc_arg);\n"; } if ($spec->{get_pc_bulk}) { $pod .= " my \$recs = \$client->${sym}($base_args$pc_bulk_arg);\n"; } $pod .= "\nEquivalent to:\n\n \$client->get('${op}', \%opts)\n\n"; } if ($spec->{add}) { $pod .= "=head2 C<add_${sym}>\n\n"; $pod .= " \$client->add_${sym}(\$data, $base_args);\n"; $pod .= "\nEquivalent to:\n\n \$client->add('${op}', \$data, \%opts)\n\n"; } if ($spec->{update}) { $pod .= "=head2 C<update_${sym}>\n\n"; $pod .= " \$client->update_${sym}(\$data, $base_args$pc_arg);\n"; $pod .= "\nEquivalent to:\n\n \$client->update('${op}', \$data, \%opts)\n\n"; } if ($spec->{delete}) { $pod .= "=head2 C<delete_${sym}>\n\n"; $pod .= " my \$ok = \$client->delete_${sym}($base_args$pc_arg);\n"; $pod .= "\nEquivalent to:\n\n \$client->delete('${op}', \%opts)\n\n"; } }
$pod .= <<EOF; =head2 last_error
last_error
Returns the last error returned by the ORCID API, if any.
log
Returns the Log::Any logger.
To install WWW::ORCID, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::ORCID
CPAN shell
perl -MCPAN -e shell install WWW::ORCID
For more information on module installation, please visit the detailed CPAN module installation guide.