Hello All, I am trying to change the PSK of my SSID using the API. However, I am getting this error message. Any help would be greatly appreciated. I've pasted the code below. VERBOSE: PUT https://n249.meraki.com/api/v0/networks/xxxxxxxxxxxxxxxxxxxxxxx/ssids/6 with -1-byte payload Invoke-RestMethod : The remote server returned an error: (400) Bad Request. At D:\Change_PSK.ps1:37 char:1 + Invoke-RestMethod -Method Put -Uri $Merakiuri -Headers $header_org -B ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 -bor [System.Net.SecurityProtocolType]::Tls11
$date = Get-Date -format "yyyyMMdd"
#$DateStr = $date.ToString("yyyyMMdd")
Write-Host $date
#Meraki API KEY
$api_key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
#Meraki Network URL
$network_id = "xxxxxxxxxxxxxxxxxxxx"
#Base API URL
$api = @{
"endpoint" = 'https://api.meraki.com/api/v0'
}
#API URL for SSID PSK Change XXX
$api_put = @{
"endpoint" = 'https://n249.meraki.com/api/v0'
}
$header_org = @{
"X-Cisco-Meraki-API-Key" = $api_key
"Content-Type" = 'application/json'
}
# PSK = New password
$data = @{
"psk" = 'NewPassword' + $date
}
Write-Host $data
#Convert data to Json format
$jbody = ConvertTo-Json -InputObject $data
#URL Network_ID and SSID number
$api.ssid = "/networks/$network_id/ssids/6"
#Combine base api_put URL and $api.ssid
$Merakiuri = $api_put.endpoint + $api.ssid
Invoke-RestMethod -Method Put -Uri $Merakiuri -Headers $header_org -Body $jbody -Verbose
... View more