Mar 6 2025
1:48 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Mar 6 2025
1:48 AM
Using Switch Port Profiles via the API.
So, i have figureed out how to create a switchPortProfile ( and delete it ). However, now i'm trying to figure out how you apply this profile to a port... Which api provides that?
def switchPortProfile(api_key: str, request_type, action, PhysicalResourceId):
"""
Manage Network Level Switch port configurations. This is an early API
This does not attempt to verify the payload. That should be done earlier.
"""
headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json",
"Accept": "application/json"
}
network_id = action['Parameters']['networkId']
match request_type:
case "Create":
url = f"https://api.meraki.com/api/v1/networks/{network_id}/switch/ports/profiles"
response = requests.post(
url=url,
headers=headers,
json=action['Parameters']['policy']
)
response.raise_for_status() # Raise an exception for bad status codes
return {
'PhysicalResourceId': response['profileId'],
'Data': {
'accessPolicyNumber': response['accessPolicyNumber']
}
}
case "Update":
url = f"https://api.meraki.com/api/v1/networks/{network_id}/switch/ports/profiles/{PhysicalResourceId}"
response = requests.put(
url=url,
headers=headers,
json=action['Parameters']['policy']
)
response.raise_for_status() # Raise an exception for bad status codes
case "Delete":
url = f"https://api.meraki.com/api/v1/networks/{network_id}/switch/ports/profiles/{PhysicalResourceId}"
response = requests.delete(
url=url,
headers=headers
)
response.raise_for_status() # Raise an exception for bad status codes
Solved! Go to solution.
1 Accepted Solution
Mar 6 2025
6:07 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Mar 6 2025
6:07 AM
You can enable them with this API call: https://developer.cisco.com/meraki/api-v1/update-device-switch-port/
If you found this post helpful, please give it Kudos. If my answer solves your problem please click Accept as Solution so others can benefit from it.
3 Replies 3
Mar 6 2025
6:07 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Mar 6 2025
6:07 AM
You can enable them with this API call: https://developer.cisco.com/meraki/api-v1/update-device-switch-port/
If you found this post helpful, please give it Kudos. If my answer solves your problem please click Accept as Solution so others can benefit from it.
Mar 6 2025
10:34 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Mar 6 2025
10:34 AM
I missed the profile property after looking at this too many times. Any idea what an Iname is??
profile:
object
Profile attributes
id:
string
When enabled, the ID of the port profile used to override the port's configuration.
iname:
string
When enabled, the IName of the profile.
enabled:
boolean
When enabled, override this port's configuration with a port profile.
Mar 6 2025
10:42 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Mar 6 2025
10:42 AM
I would guess the profiles name in the GUI but I don't know for certain and have not used the feature yet to test myself
If you found this post helpful, please give it Kudos. If my answer solves your problem please click Accept as Solution so others can benefit from it.

Get notified when there are additional replies to this discussion.