(plugin) apps::backup::rubrik::restapi - retrieve token (#3518)

This commit is contained in:
qgarnier 2022-03-02 10:30:29 +01:00 committed by GitHub
parent 19df1b0b09
commit 94a7374394
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -136,7 +136,8 @@ sub get_token {
) { ) {
$self->settings(); $self->settings();
my $content = $self->{http}->request( my $content = $self->{http}->request(
url_path => '/api/v1/cluster/me', method => 'POST',
url_path => '/api/v1/session',
credentials => 1, credentials => 1,
basic => 1, basic => 1,
username => $self->{api_username}, username => $self->{api_username},
@ -208,6 +209,7 @@ sub request_api {
$self->settings(); $self->settings();
my $creds = $self->credentials(); my $creds = $self->credentials();
my ($content) = $self->{http}->request( my ($content) = $self->{http}->request(
method => 'GET',
url_path => '/api/internal' . $options{endpoint}, url_path => '/api/internal' . $options{endpoint},
get_param => $options{get_param}, get_param => $options{get_param},
%$creds %$creds
@ -218,6 +220,7 @@ sub request_api {
$self->clean_token(); $self->clean_token();
$creds = $self->credentials(); $creds = $self->credentials();
$content = $self->{http}->request( $content = $self->{http}->request(
method => 'GET',
url_path => '/api/internal' . $options{endpoint}, url_path => '/api/internal' . $options{endpoint},
get_param => $options{get_param}, get_param => $options{get_param},
%$creds, %$creds,