Jump to content

Any reason why a working script would no longer work - getting 200 response but no data


Recommended Posts

I have what was a working PowerShell script to get a list of all my systems in Pulseway.  It is no longer working. I am getting a 200 response, just no data. I even tried to replicate it in Node JS since there is official documentation for it, but I get the same response - 200 but no data.

$username = 'administrator'
$password = '*************'

#Adding credentials to header
$header = @{Authorization = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("$($username):$($password)")) }

#Call API to return first 100 systems - calls are limited to 100 results
$first100 = Invoke-RestMethod -uri https://xxxxxxxxxxxx.pulseway.com/api/v2/systems -Method GET -Header $header -ContentType "application/json"
#Call API to return second 100 systems using offset of 100 as a query
$second100 = Invoke-RestMethod -uri https://xxxxxxxxxxx.pulseway.com/api/v2/systems?offset=100 -Method GET -Header $header -ContentType "application/json"

#Create and calculate variable for total number of systems counted
$total = 0
$total += $first100.data.length
$total += $second100.data.length

Foreach ($r in $first100.data) {
    If ($r.name[6] -match "-" -and $r.group -match "US Workstations") {
        Write-Host $r.name
    }
}

Foreach ($r in $second100.data) {
    If ($r.name[6] -match "-" -and $r.group -match "US Workstations") {
        Write-Host $r.name
    }
Link to post
Share on other sites

I cannot replicate the issue:

I have just run your script, only modifying the password, the URI, and I removed the IF statement so it returned all hosts.  

It worked first time. I suggest you raise this with Support, as it is most likely to be something with your tenancy - and hopefully they can see why?  

Would appreciate you posting the solution if you get it! I'm going to embark on API integration soon, so I may come across similar issues!

Thanks, 

Link to post
Share on other sites
Posted (edited)

@Jamie Taylor - I've mentioned this before to our account manager and in general feedback, but is it possible that customers could get a list of defects resolved per release? Its frustrating to not know what has or hasn't been fixed. All we see in the release notes is the new features, not development that has improved existing functionality. 

 

FYI - This should not be a feature request, this is something nearly all SaaS companies do in one way or another. Please don't direct me to the feature request upvoting site!

Edited by WYE
missed out the word "not"!
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...