Sure Master, Can you please check below code> I would like to use the access_token value retrieved from webapp.pm in sub api_call3 $value2
package Op; use strict; use warnings; use Win32::Process; use Storable; use IO::Socket::SSL; use REST::Client; use JSON::Parse ':all'; use MIME::Base64; use Term::ReadKey; use Data::Dumper; use MIME::Lite; use Net::SMTP; use webapp qw/@access_token/; use Spreadsheet::XLSX; use Spreadsheet::ParseXLSX; use Excel::Writer::XLSX; sub api_call3 { $client->default_header( 'content-type' => 'application/json' ); $client->default_header( 'Accept' => 'application/json' ); $client->default_header( 'Authorization' => "Bearer $value2" ); $client->request(HTTP::Request->new('GET', "$_[0]")); } sub result3 { my ($args) = @_; my $oktadev = $args->{OKTAUsersList}; my $email = $args->{Email}; my @responsetext; my @responsalter; $strExcelFilename1 = "C:/PERL/" . "OKTADev-Profile-User-Details" . + $date . ".xlsx"; my $apiurlapplog2 = "https://dev.oktapreview.com" ."/api/v1/users? +"; my $response = api_call3($apiurlapplog2); print "Response:\n"; @responsetext = parse_json ($response->content); my $workbook = Excel::Writer::XLSX->new( $strExcelFilename1 ); for my $i (0..$#responsetext) { my $responseid = $responsetext[$i]{id}; my $responsests = $responsetext[$i]{status}; if ($responsests ne "DEPROVISIONED") { $worksheet->write(0, 0, 'OKTA-ID'); $worksheet->write(0, 1, 'FIRST NAME'); $worksheet->write(0, 2, 'LAST NAME'); $worksheet->write($r, 0, $responseid); $worksheet->write($r, 1, $responsetext[$i]{profile}{firstName}); $worksheet->write($r, 2, $responsetext[$i]{profile}{lastName}); $r += 1; } } }
In reply to Re^6: Unable to execute the get method from app.psgi file for Dancer2 app.
by chandantul
in thread Unable to execute the get method from app.psgi file for Dancer2 app.
by chandantul
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |