Hello all, can someone let me where the Java message come from? And how to resolve my code? I just wanting to create a SR request from a template.
---My code--
[Net.ServicePointManager]::SecurityProtocol = "Tls, Tls11, Tls12, Ssl3"
$sysAidURI = "https://mycompany.sysaidit.com/api/v1"
Invoke-WebRequest -Uri "$sysAidURI/login" -ContentType "application/json" -Body '{"user_name": "username", "password": "password"}' -Method 'POST' -SessionVariable websession
$Body= '{
"info": [{"key":"due_date", "value":1646857974017},
{"key":"status", "value":2},
{"key":"problem_type","value":"Vulnerability Management"},
{"key":"notes","value":[
{"userName":"sysaid","createDate":1646857974017,"text":"Note 123"}
]},
{"responsibility":35}]
}'
$Data = Invoke-RestMethod -uri "$sysAidURI/sr?type=request&template=145" -WebSession $websession -method POST -ContentType application/json -Body $Body
---And the terminal output----
Invoke-RestMethod : {"status":500,"message":"java.lang.Long cannot be cast to java.lang.String"}
At C:\Users\phamjp\Resilio_Sync\NTT Data Fed\RIC_Scripting\SysAid\create_sr.ps1:19 char:9
+ $Data = Invoke-RestMethod -uri "$sysAidURI/sr?type=request&template=1 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
I'm unable create the SR and get this java error...any help will greatly appreciate.
---My code--
[Net.ServicePointManager]::SecurityProtocol = "Tls, Tls11, Tls12, Ssl3"
$sysAidURI = "https://mycompany.sysaidit.com/api/v1"
Invoke-WebRequest -Uri "$sysAidURI/login" -ContentType "application/json" -Body '{"user_name": "username", "password": "password"}' -Method 'POST' -SessionVariable websession
$Body= '{
"info": [{"key":"due_date", "value":1646857974017},
{"key":"status", "value":2},
{"key":"problem_type","value":"Vulnerability Management"},
{"key":"notes","value":[
{"userName":"sysaid","createDate":1646857974017,"text":"Note 123"}
]},
{"responsibility":35}]
}'
$Data = Invoke-RestMethod -uri "$sysAidURI/sr?type=request&template=145" -WebSession $websession -method POST -ContentType application/json -Body $Body
---And the terminal output----
Invoke-RestMethod : {"status":500,"message":"java.lang.Long cannot be cast to java.lang.String"}
At C:\Users\phamjp\Resilio_Sync\NTT Data Fed\RIC_Scripting\SysAid\create_sr.ps1:19 char:9
+ $Data = Invoke-RestMethod -uri "$sysAidURI/sr?type=request&template=1 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
I'm unable create the SR and get this java error...any help will greatly appreciate.