Update SSID psk with Google Apps Script

Solved
MikeMW
New here

Update SSID psk with Google Apps Script

Hi, I'm trying to update psk using Apps Script. But I can't seem to make the put method works. 

function updateSSID(apiKey, netId, t0, t1) {
  var payload = {'psk': 'abcdefghij'};
  var options = {
  'method' : 'PUT',
  'headers':{'X-Cisco-Meraki-API-Key': apiKey},
  'contentType': 'application/json',
  // Convert the JavaScript object to a JSON string.
  'payload' : JSON.stringify(payload)
  };
  var response = UrlFetchApp.fetch("https://api.meraki.com/api/v0/networks/"+netId+"/ssids/2", options);
  Logger.log(response); 
}

Here is the response I get:

{"number":2,"name":"Meeting","enabled":true,"splashPage":"None","ssidAdminAccessible":false,"authMode":"psk","psk":"oldpassword","encryptionMode":"wpa","wpaEncryptionMode":"WPA1 and WPA2","ipAssignmentMode":"NAT mode","minBitrate":1,"bandSelection":"Dual band operation","perClientBandwidthLimitUp":5120,"perClientBandwidthLimitDown":5120}

Please help.

1 Accepted Solution
MikeMW
New here

Well, this is embarrassing, minutes later I found this https://community.meraki.com/t5/Solutions-APIs/Attempting-to-Change-PSK-of-SSID-with-Meraki-API-via-...

 

I changed the url from 'https://api.meraki.com/....' to 'https://nXXX.meraki.com/....' and it works.  

View solution in original post

1 Reply 1
MikeMW
New here

Well, this is embarrassing, minutes later I found this https://community.meraki.com/t5/Solutions-APIs/Attempting-to-Change-PSK-of-SSID-with-Meraki-API-via-...

 

I changed the url from 'https://api.meraki.com/....' to 'https://nXXX.meraki.com/....' and it works.  

Get notified when there are additional replies to this discussion.