Qualys CSAM API – Index 1 out of bounds for length 1

A niche error probably, just my luck being stuck with it for a major part of my Friday evening today. πŸ™‚

Qualys CSAM API. You authenticate against it like this:

Doesn’t work for me. I get the following error:

If I use PowerShell that too does not work.

Here’s the error:

This variant of PowerShell works though, which is how I was using it so far in my PowerShell code:

Today, however, I wanted to get this working against Power Automate, so that’s why I was troubleshooting again. With Power Automate, the HTTP connector would just hang there. No errors.

I figure PowerShell is able to do some conversion internally in the second variant (where I pass the body as a hash table), but what is it doing? It’s not converting to JSON (and I tested that anyways, coz I was out of ideas).

Not having much ideas, I then tried Bruno. It too works fine.

Hopefully Bruno shows me what’s happening behind the scenes. And indeed it does! The Timeline tab.

See how certain characters of the password are being escaped! That was it. Bruno and the second variant of PowerShell were escaping behind the scenes.

Once I copied this escaped version of the password to curl, PowerShell, and Power Automate these too started working fine. πŸ₯³