-
Notifications
You must be signed in to change notification settings - Fork 13
Description
Hi Luke,
Would love to be able to use your script, there seems to be an issue with the [Update Generate-Device-Alert-Heatmap.ps1] with the latest v2 API, it's not connecting.
I am just getting started with using the API, so unsure how to fix this myself. I know my ClientID and Secret are ok, the URL is the US instance, and I get this error.
Are you able to point me in the right direction?
Thanks
Jamie
Invoke-WebRequest : { "resultCode": "FAILURE", "errorMessage": "HTTP 405 Method Not Allowed", "incidentId":
"WEB_MGMT_SERVICE-956f20578bc34edb8456583676006ba7-1754162494-WDWUOPGK" }
At C:\ProgramData\NinjaRMMAgent\scripting\customscript_gen_1754162494379_240.ps1:98 char:11
-
$Result = Invoke-WebRequest -uri "$ ($NinjaURL)/ws/oauth/token" -Metho ... -
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~- CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebExc
eption - FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
ConvertFrom-Json : Cannot bind argument to parameter 'InputObject' because it is null.
At C:\ProgramData\NinjaRMMAgent\scripting\customscript_gen_1754162494379_240.ps1:101 char:52
- CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebExc
- ... uthorization' = "Bearer $(($Result.content | ConvertFrom-Json).access ...
-
~~~~~~~~~~~~~~~~- CategoryInfo : InvalidData: (:) [ConvertFrom-Json], ParameterBindingValidationException
- FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.ConvertFrom
JsonCommand
Invoke-WebRequest : {"error":"missing_header","error_description":"Missing required header","error_code":2}
At C:\ProgramData\NinjaRMMAgent\scripting\customscript_gen_1754162494379_240.ps1:108 char:13
-
$Devices = (Invoke-WebRequest -uri "$ ($NinjaURL)/api/v2/devices" -Met ... -
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~- CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebExc
eption - FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
- CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebExc