<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Using Switch Port Profiles via the API. in Network Platform API</title>
    <link>https://community.cisco.com/t5/network-platform-api/using-switch-port-profiles-via-the-api/m-p/5400150#M456</link>
    <description>&lt;P&gt;You can enable them with this API call: &lt;A href="https://developer.cisco.com/meraki/api-v1/update-device-switch-port/" target="_blank" rel="nofollow noopener noreferrer"&gt;https://developer.cisco.com/meraki/api-v1/update-device-switch-port/&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 06 Mar 2025 14:07:17 GMT</pubDate>
    <dc:creator>mloraditch</dc:creator>
    <dc:date>2025-03-06T14:07:17Z</dc:date>
    <item>
      <title>Using Switch Port Profiles via the API.</title>
      <link>https://community.cisco.com/t5/network-platform-api/using-switch-port-profiles-via-the-api/m-p/5400149#M455</link>
      <description>&lt;P&gt;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?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample language-python"&gt;&lt;CODE&gt;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&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Mar 2025 09:48:41 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/using-switch-port-profiles-via-the-api/m-p/5400149#M455</guid>
      <dc:creator>afrazer</dc:creator>
      <dc:date>2025-03-06T09:48:41Z</dc:date>
    </item>
    <item>
      <title>Re: Using Switch Port Profiles via the API.</title>
      <link>https://community.cisco.com/t5/network-platform-api/using-switch-port-profiles-via-the-api/m-p/5400150#M456</link>
      <description>&lt;P&gt;You can enable them with this API call: &lt;A href="https://developer.cisco.com/meraki/api-v1/update-device-switch-port/" target="_blank" rel="nofollow noopener noreferrer"&gt;https://developer.cisco.com/meraki/api-v1/update-device-switch-port/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Mar 2025 14:07:17 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/using-switch-port-profiles-via-the-api/m-p/5400150#M456</guid>
      <dc:creator>mloraditch</dc:creator>
      <dc:date>2025-03-06T14:07:17Z</dc:date>
    </item>
    <item>
      <title>Re: Using Switch Port Profiles via the API.</title>
      <link>https://community.cisco.com/t5/network-platform-api/using-switch-port-profiles-via-the-api/m-p/5400151#M457</link>
      <description>&lt;P&gt;I missed the profile property after looking at this too many times.    Any idea what an Iname is??&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample language-markup"&gt;&lt;CODE&gt;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.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 06 Mar 2025 18:34:56 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/using-switch-port-profiles-via-the-api/m-p/5400151#M457</guid>
      <dc:creator>afrazer</dc:creator>
      <dc:date>2025-03-06T18:34:56Z</dc:date>
    </item>
    <item>
      <title>Re: Using Switch Port Profiles via the API.</title>
      <link>https://community.cisco.com/t5/network-platform-api/using-switch-port-profiles-via-the-api/m-p/5400152#M458</link>
      <description>&lt;P&gt;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&lt;/P&gt;</description>
      <pubDate>Thu, 06 Mar 2025 18:42:49 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/using-switch-port-profiles-via-the-api/m-p/5400152#M458</guid>
      <dc:creator>mloraditch</dc:creator>
      <dc:date>2025-03-06T18:42:49Z</dc:date>
    </item>
  </channel>
</rss>

