NetBackup API call format works in Unix but not Windows
- 4 years ago
So I was finally able to resolve this issue by using the builtin Invoke-WebRequest command. Here is the syntax that I used (Note - auth_header, tokenName and hostId were defined earlier in the script):
$basepath="https://" + $NBU_master + "/netbackup/"
$uri = $basepath + "security/securitytokens"
$reason = "Re-Install"
$allowedCount = 1
$validFor = 3600
$reissue_token = 1
$type = @{
tokenName=$tokenName
hostId=$hostId
reason=$reason
allowedCount=$allowedCount
validFor=$validFor
type=$reissue_token
}
$response = Invoke-WebRequest `
-Headers $auth_header `
-Method POST `
-Uri $uri `
-Body (ConvertTo-Json -InputObject $type) `
-ContentType $content_header_3
$convert = (ConvertFrom-Json -InputObject $response)
$tokenValue=$convert.tokenValue
Thank you for your help.