Trying to update SSID PSK receiving 404

Solved
StephenMeyer
Here to help

Trying to update SSID PSK receiving 404

I can successfully call and get the data from getting a specific SSID network details, when i try to update the password {psk} i get a 404. Below is a snippet of the powershell code i am trying,

 

$deviceAPIUri = "$baseUrl$dashboardAPIVersion/networks/$MYNETWORK_ID/wireless/ssids/$GUEST_ID"
$response = Invoke-WebRequest -Uri $deviceAPIUri -Method GET -Headers $headers
 
 
#
# Check if Guest

if ($response.StatusCode -eq 200 ){

 
$ssidConfig = $response | ConvertFrom-Json

$ssidConfig.psk = "HelloThere"

#
#create JSON body with data to update.
#
 
$body = (ConvertTo-Json $ssidConfig)

Write-Host $body

$response1 = Invoke-RestMethod -Uri $deviceAPIUri -Method POST -Headers $headers -Body $body

write-host $response1
 
 
Please help. I have been able to use powershell and interact with the dashboard API without fail... until now.
1 Accepted Solution
Greenberet
Head in the Cloud

Found your issue... You have to use PUT and not POST

 

Greenberet_0-1647267265606.png

 

View solution in original post

7 Replies 7
Greenberet
Head in the Cloud

You are probably adding empty data from the "full" get result.

 

If you just want to change the SSID, then just change the SSID

 

json body:

 

{'psk': 'HelloThere'}

 

StephenMeyer
Here to help

I changed code to just send psk with same results. I get a 404 not found.  The new json body: {"psk": "hello"}

Greenberet
Head in the Cloud

I'm not sure about the response here and can't test it at the moment, but "hello" is to short for a psk. "HelloThere" did work fine for me

StephenMeyer
Here to help

I updated to HelloThere and still receiving the 404.  What is strange is the GET works without fail. It is only the post. 

Greenberet
Head in the Cloud

Found your issue... You have to use PUT and not POST

 

Greenberet_0-1647267265606.png

 

StephenMeyer
Here to help

Thank you so much... missed that.

Greenberet
Head in the Cloud

No problem 😃

sometimes the issues are in the smallest mistakes ^^

Get notified when there are additional replies to this discussion.