Joe_Williams
7 years agoExpert
HTTP Authentication Required?
I have two sets of code. 1 pulls all 'Services' or Website groups. The other is supposed to just pull the group name and id. The first works, the second doesn't. I am using the base PowerShell script laid out in the documentation.
If I remove the ?fields=name,id it works without issue. If I add it back it gives me this error "HTTP Status 401 - Unauthorizedtype Status
reportmessage Unauthorizeddescription This request requires HTTP authentication.LogicMonitor Technical Operations". Any help would be awesome.
<# request details #> $httpVerb = 'GET' $resourcePath = '/service/groups?fields=name,id' $status = $null $body = $null $response = $null <# Construct URL #> $url = 'https://' + $company + '.logicmonitor.com/santaba/rest' + $resourcePath
The documentation isn't correct it appears in some areas.
$httpVerb = 'GET' $resourcePath = '/setting/collectors' $queryParams = '?fields=id,description,hostname' $data = '' $url = 'https://' + $company + '.logicmonitor.com/santaba/rest' + $resourcePath + $queryParams <# Concatenate Request Details #> $requestVars = $httpVerb + $epoch + $data + $resourcePath
I had to add a blank data variable. Once I did that everything worked. I found that string via the Python code.