Help for Aruba API Integration

I’m doing an integration with aruba API and I need help, I’m calling the URL as follows

$Variable = Invoke-WebRequest -Uri $URL -ContentType "application/json" | ConvertFrom-Json Write-Host $Variable

But the result doesn’t come as $variable.xyz, several lines and topics are in one big result without me being able to select what I want.

Has anyone ever experienced this? Can you help me here?

@pedrodaltoe Welcome to PowerShell.org forums.

... | ConvertFrom-Json Write-Host $Variable is this a typo ?

Invoke-WebRequest has many members in its output and is not json, normally the content from the Invoke-WebRequest output is converted to json. You could try with Invoke-RestMethod which directly gives you objects.

Hello,

I really appreciate the help and the time available, even using Invoke-RestMethod I still get a huge return, without being able to make filters like $variable.xyz

$variable = Invoke-RestMethod -Uri $URL -ContentType “application/json”

Write-Host $variable

I get the feedback below:

“@{Status=Success; Status-code=0; CLI Command executed=show clients
; IAP IP address=IPAdresss_Targer; Command output=cli output:
COMMAND=show clients
Client List
Name IP Address MAC Address OS ESSID Access Point Channel Type Role IPv6 Address
Signal Speed ​​(mbps)”

I did it then

Write-Host $variable.‘Command output’ and got the following return:

From here I don’t know how to proceed anymore.

In the DOC, as you can see bellow the Curl to get results is this (page 65)

curl -k “URL” -H “Content-Type:application/json”

https://support.hpe.com/hpesc/public/docDisplay?docId=a00101273en_us

you don’t need to use Write-Host.
$Variable is an object should have everything you need. I would suggest to read

ConvertFrom-Json (Microsoft.PowerShell.Utility) - PowerShell | Microsoft Docs and
ConvertTo-Json (Microsoft.PowerShell.Utility) - PowerShell | Microsoft Docs
in detail, It should help you for sure.

Between what are you finally expecting from the output ?

I hope the output brings me the object “$variable.‘Command output’.ESSID” that I can select, but as you can see the objects don’t exist.

Again, thanks for your time.

If command output is what is in the output window, then its not an object that you can pick ESSID as a property, its just plain string.
Try using ConvertFrom-String cmdlet and see if you can use Select-Object to pick the specific column.

$Variable.'Comand Output' | ConvertFrom-String

Tks a lot, a did by Split and works fine.