- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Cycle port API not working "None of the fields... were specified"
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:
Solved! Go to solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The request should be a POST and not PUT.
> curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Could it be that your $url statement is set somewhere else aswell, and it's that statement that's being used?
According to your error message, if failing on the endpoint ressource /devices/{serial}/switch/ports/{portId}, but the ressource for cycling the port is /devices/{serial}/switch/ports/cycle as you've also stated yourself.
So I'm assuming that $url is being set somewhere to /devices/{serial}/switch/ports/{portId}
I haven't worked with PHP for a long time, but I think it looks correct.
Like what you see? - Give a Kudo ## Did it answer your question? - Mark it as a Solution 🙂
All code examples are provided as is. Responsibility for Code execution lies solely your own.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The URL is only set as https://api.meraki.com/api/v1/devices/{serial}/switch/ports/cycle
The response is strange.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
you are not changing the {serial} to any real serial number in the URL.
the URL should look like this https://api.meraki.com/api/v1/devices/Q2BX-XXXX-XXXX/switch/ports/cycle
just with the real serial number of your switch
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No it's there, I didn't want to display it in this forum.
it's in the format Q2GX-XXXX-XXXX
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The request should be a POST and not PUT.
> curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes that was it I missed that. Thank you!
