Hey all! Wondering if someone can give me a hand with an API request - first up, it’s working perfect in Python with the following code
import requests
url = "https://10.8.96.151/retrieve"
payload={'data': '{"op": "showConfig", "path": []}',
'key': 'supersecretkey'
}
headers = {}
response = requests.request("POST", url, headers=headers, data=payload, verify=False)
print(response.text)
What I want, is to do the same request in PowerShell. I’ve done the following, however it doesn’t seem to recognize my data field, throwing a non-empty data field is required error.
$uri = "https://10.8.96.151/retrieve"
$data = @"
{
"data": '{"op": "showConfig","path": []}',
"key": "SuperSecret"
}
"@
Invoke-WebRequest -Uri $uri -SkipCertificateCheck -Body $newdata -Method POST
What am I doing wrong here?