<?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 Create site using dnacentersdk in Network Platform API</title>
    <link>https://community.cisco.com/t5/network-platform-api/create-site-using-dnacentersdk/m-p/4680746#M8852</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have been trying for some time to create a site using the dnacentersdk but I cannot seems to get the syntax right.&lt;/P&gt;
&lt;P&gt;I am using DNAC version 2.2.3.6 with the following python code:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;from dnacentersdk import api

    dnac = api.DNACenterAPI(username=args.username,
                            password=args.password,
                            base_url=args.host,
                            version='2.2.3.3',
                            verify=False)

task = dnac.sites.create_site(site="test", type="building")
pprint(task)&lt;/LI-CODE&gt;
&lt;P&gt;I get a response from the DNAC but the site is never created.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{'executionId': 'ff773387-412c-41c4-a4c7-df50bca7d2dc',
 'executionStatusUrl': '/dna/platform/management/business-api/v1/execution-status/ff773387-412c-41c4-a4c7-df50bca7d2dc',
 'message': 'The request has been accepted for execution'}&lt;/LI-CODE&gt;
&lt;P&gt;An example of how to create a site using the SDK would be appreciated.&lt;/P&gt;</description>
    <pubDate>Sat, 03 Sep 2022 14:54:36 GMT</pubDate>
    <dc:creator>rasmus.elmholt</dc:creator>
    <dc:date>2022-09-03T14:54:36Z</dc:date>
    <item>
      <title>Create site using dnacentersdk</title>
      <link>https://community.cisco.com/t5/network-platform-api/create-site-using-dnacentersdk/m-p/4680746#M8852</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have been trying for some time to create a site using the dnacentersdk but I cannot seems to get the syntax right.&lt;/P&gt;
&lt;P&gt;I am using DNAC version 2.2.3.6 with the following python code:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;from dnacentersdk import api

    dnac = api.DNACenterAPI(username=args.username,
                            password=args.password,
                            base_url=args.host,
                            version='2.2.3.3',
                            verify=False)

task = dnac.sites.create_site(site="test", type="building")
pprint(task)&lt;/LI-CODE&gt;
&lt;P&gt;I get a response from the DNAC but the site is never created.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{'executionId': 'ff773387-412c-41c4-a4c7-df50bca7d2dc',
 'executionStatusUrl': '/dna/platform/management/business-api/v1/execution-status/ff773387-412c-41c4-a4c7-df50bca7d2dc',
 'message': 'The request has been accepted for execution'}&lt;/LI-CODE&gt;
&lt;P&gt;An example of how to create a site using the SDK would be appreciated.&lt;/P&gt;</description>
      <pubDate>Sat, 03 Sep 2022 14:54:36 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/create-site-using-dnacentersdk/m-p/4680746#M8852</guid>
      <dc:creator>rasmus.elmholt</dc:creator>
      <dc:date>2022-09-03T14:54:36Z</dc:date>
    </item>
    <item>
      <title>Re: Create site using dnacentersdk</title>
      <link>https://community.cisco.com/t5/network-platform-api/create-site-using-dnacentersdk/m-p/4680760#M8853</link>
      <description>&lt;P&gt;Found some code that did what I wanted, and worked.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;### Helper functions
def create_area_request(area_name=None, area_parentName=None):
    payload = {
    "type": "area",
    	"site": {
            "area": {
            	"name": area_name,
            	"parentName": area_parentName
            }
    	}
    }
    return payload

def create_bld_request(area_name, area_parentName, bld_name, bld_address):
    payload = {
    "type": "building",
        "site": {
            "area": {
                "name": area_name,
                "parentName": area_parentName
            },
            "building": {
                "name": bld_name,
                "address": bld_address
            }
        }
    }
    return payload

task = dnac.sites.create_site(payload=create_bld_request("Aarhus", "Global/EMEA/Denmark", "Tangen9, 8200", "Tangen 9, 8200 Aarhus, Denmark"))&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 03 Sep 2022 15:49:42 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/create-site-using-dnacentersdk/m-p/4680760#M8853</guid>
      <dc:creator>rasmus.elmholt</dc:creator>
      <dc:date>2022-09-03T15:49:42Z</dc:date>
    </item>
  </channel>
</rss>

