Я пытаюсь создать REST-соединение с ISIM (6.0). Согласно: https://developer.ibm.com/answers/questions/289830/how-to-authenticate-to-isim-via-rest-apis/ есть 3 шага, чтобы сделать это.
Мне удалось создать ниже скрипт
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12
$URL = "https://<hostname>:9443/itim/"
$LOGIN_URL = "$($URL)restlogin/login.jsp"
$REST = "$($URL)rest/"
$LTPA = "$($URL)j_security_check"
$cookiejar = New-Object System.Net.CookieContainer
$webrequest = [System.Net.HTTPWebRequest]::Create($LOGIN_URL);
$webrequest.CookieContainer = $cookiejar
$response = $webrequest.GetResponse()
$cookies = $cookiejar.GetCookies($LOGIN_URL)
$session = New-Object Microsoft.PowerShell.Commands.WebRequestSession
$session.Cookies.Add($cookies)
$body = ""
$Headers = "j_username=<username>&j_password=<password>"
$LTPA = "https://<hostname>:9443/itim/j_security_check?j_username=<username>&j_password=<password>"
$VAR = Invoke-RestMethod -URI $LTPA -body $cookies -Method POST #-ContentType "application/json" #-body $cookies
Write-Host "3"
$ME = "https://<hostname>:9443/itim/rest/systemusers/me"
$VAR2 = Invoke-RestMethod -URI $ME -body $cookies -Method POST
однако я не могу установить соединение только:
Invoke-RestMethod : The remote server returned an error: (404) Not Found.
Кто-нибудь может мне помочь с этим?