I'm using Curl through PHP to try to cycle a port, I have done this according to the docs but it's not working.
Getting the error: Array ( [0] => Error for /devices/{serial}/switch/ports/{portId}: None of the fields ('name', 'tags', 'enabled', 'poeEnabled', 'type', 'vlan', 'voiceVlan', 'allowedVlans', 'isolationEnabled', 'rstpEnabled', 'stpGuard', 'linkNegotiation', 'portScheduleId', 'udld', 'accessPolicyType', 'accessPolicyNumber', 'macAllowList', 'stickyMacAllowList', 'stickyMacAllowListLimit', 'stormControlEnabled', 'adaptivePolicyGroupId', 'peerSgtCapable', 'flexibleStackingEnabled', 'daiTrusted' or 'profile') were specified. ) )
According to the docs all I need to post is { "ports": [ "17" ]}
https://developer.cisco.com/meraki/api-latest/#!cycle-device-switch-ports
This is my code:
$json_data = '{ "ports": [ "17" ]}';
$headr = array();
$headr[] = 'Content-Type: application/json';
$headr[] = 'Accept: application/json';
$headr[] = 'X-Cisco-Meraki-API-Key: '.$apikey;
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER,$headr);
curl_setopt($curl, CURLOPT_POSTFIELDS, $json_data);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
$reply = curl_exec($curl);