Help with API please

4 comments started 2024-04-03 last 2024-04-04
APIsHome Automation
R
#1 RE320

Hi,

I'm getting this error when running this code in Powershell

$Giv_En = Invoke-RestMethod -Method 'Get' -Uri https://api.givenergy.cloud/inverter/v1/$SerialNum/system-data/latest/ -Headers $headers_Giv_En

_Invoke-RestMethod : The remote server returned an error: (404) Not Found.
At line:1 char:12

  • $Giv_En = Invoke-RestMethod -Method 'Get' -Uri https://api.givenergy ...

  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand_
    --------------

    I've generated a new token, and tried the URL without /v1/.

    Thanks in advance.

#2 hoggy

That looks suspiciously like it's from one of my Powershell scripts (or some variation of it) so have you added your Serial Number in to the script at the top ok?

Mine still appears to be running as it's output is still up to date and I've not touched it for months: https://terravolt.co.uk/API/RAW/InvData_Now.txt

What inverter do you have, I know the new 3 phase one didn't play nice with the API initially but that was a while ago.

R
#3 RE320

hoggy

Hi, it is your script, thank you. I've added the serial number. The inverter is a GIV-HY-3.6-G3.

I'll take a look at your page. Thank you

R
#4 RE320

Issue resolved. It was the serial number.