404
edits
No edit summary |
|||
Line 39: | Line 39: | ||
Invoke-RestMethod on the PowerShell needs a few parameters for the access of the Allegro Network Multimeter: | Invoke-RestMethod on the PowerShell needs a few parameters for the access of the Allegro Network Multimeter: | ||
To set the user name for basic authorization, use the '''-Headers''' parameter | To set the user name for basic authorization, use the '''-Headers''' parameter: | ||
<code>-Headers @{Authorization = ("Basic {0}" -f [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f 'USER', 'PASSWORD'))))}</code> | <code>-Headers @{Authorization = ("Basic {0}" -f [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f 'USER', 'PASSWORD'))))}</code> | ||
You also need to announce that you accept JSON as response with: | |||
<code>Invoke-RestMethod - | <code>-ContentType'application/json; charset=utf-8'</code> | ||
To disable the certificate check, use: | |||
<code>-SkipCertificateCheck</code> | |||
The URL must be passed with the parameter '''-URI''', so the full command is: | |||
<code>Invoke-RestMethod -Uri 'https://allegro-mm-XXXX/...' -Headers @{Authorization = ("Basic {0}" -f [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f 'USER', 'PASSWORD'))))} -ContentType'application/json; charset=utf-8' -Method 'Get' -SkipCertificateCheck</code> | |||
== Examples == | == Examples == |
edits