<?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 Powershell Generate DPSK though API, but respond 400 error in SmartZone and Virtual SmartZone</title>
    <link>https://community.ruckuswireless.com/t5/SmartZone-and-Virtual-SmartZone/Powershell-Generate-DPSK-though-API-but-respond-400-error/m-p/44407#M3797</link>
    <description>&lt;P&gt;I wrote a Powershell script to generate DPSK for users, it works well on query Wlan, Zone, UserRole and other APIs..&lt;/P&gt;&lt;P&gt;But, when I want to generate a DPSK, it responded 400 error. I don't know what is the problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;$UrlBase = "&lt;A href="https://10.16.1.14:8443/wsg/api/public" target="_blank"&gt;https://10.16.1.14:8443/wsg/api/public&lt;/A&gt;";&lt;BR /&gt;$apiVer = "v9_1"&lt;BR /&gt;$Zone_Id = "69e07745-bac7-4e24-9500-3902960e9700"&lt;BR /&gt;$Wlan_Id = "22"&lt;/P&gt;&lt;P&gt;$websession (believe me, $websession works well)&lt;/P&gt;&lt;P&gt;$body_gen=[pscustomobject]@{&lt;BR /&gt;amount = "1"&lt;BR /&gt;userName = "abc"&lt;BR /&gt;userRoleId = "e1538f2a-082c-4e19-b9d7-bc78de006967"&lt;BR /&gt;vlanId = ""&lt;BR /&gt;groupDpsk = "false"&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;$body_gen_JSON=$body_gen | ConvertTo-Json&lt;/P&gt;&lt;P&gt;Invoke-WebRequest -Uri $UrlBase/$apiVer/rkszones/$Zone_Id/wlans/$Wlan_Id/dpsk/batchGenUnbound -Method POST -Body $body_gen_JSON -ContentType 'application/json;charset=UTF-8' -WebSession $websession&lt;/P&gt;</description>
    <pubDate>Fri, 25 Mar 2022 16:35:00 GMT</pubDate>
    <dc:creator>is_trouser</dc:creator>
    <dc:date>2022-03-25T16:35:00Z</dc:date>
    <item>
      <title>Powershell Generate DPSK though API, but respond 400 error</title>
      <link>https://community.ruckuswireless.com/t5/SmartZone-and-Virtual-SmartZone/Powershell-Generate-DPSK-though-API-but-respond-400-error/m-p/44407#M3797</link>
      <description>&lt;P&gt;I wrote a Powershell script to generate DPSK for users, it works well on query Wlan, Zone, UserRole and other APIs..&lt;/P&gt;&lt;P&gt;But, when I want to generate a DPSK, it responded 400 error. I don't know what is the problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;$UrlBase = "&lt;A href="https://10.16.1.14:8443/wsg/api/public" target="_blank"&gt;https://10.16.1.14:8443/wsg/api/public&lt;/A&gt;";&lt;BR /&gt;$apiVer = "v9_1"&lt;BR /&gt;$Zone_Id = "69e07745-bac7-4e24-9500-3902960e9700"&lt;BR /&gt;$Wlan_Id = "22"&lt;/P&gt;&lt;P&gt;$websession (believe me, $websession works well)&lt;/P&gt;&lt;P&gt;$body_gen=[pscustomobject]@{&lt;BR /&gt;amount = "1"&lt;BR /&gt;userName = "abc"&lt;BR /&gt;userRoleId = "e1538f2a-082c-4e19-b9d7-bc78de006967"&lt;BR /&gt;vlanId = ""&lt;BR /&gt;groupDpsk = "false"&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;$body_gen_JSON=$body_gen | ConvertTo-Json&lt;/P&gt;&lt;P&gt;Invoke-WebRequest -Uri $UrlBase/$apiVer/rkszones/$Zone_Id/wlans/$Wlan_Id/dpsk/batchGenUnbound -Method POST -Body $body_gen_JSON -ContentType 'application/json;charset=UTF-8' -WebSession $websession&lt;/P&gt;</description>
      <pubDate>Fri, 25 Mar 2022 16:35:00 GMT</pubDate>
      <guid>https://community.ruckuswireless.com/t5/SmartZone-and-Virtual-SmartZone/Powershell-Generate-DPSK-though-API-but-respond-400-error/m-p/44407#M3797</guid>
      <dc:creator>is_trouser</dc:creator>
      <dc:date>2022-03-25T16:35:00Z</dc:date>
    </item>
    <item>
      <title>Re: Powershell Generate DPSK though API, but respond 400 error</title>
      <link>https://community.ruckuswireless.com/t5/SmartZone-and-Virtual-SmartZone/Powershell-Generate-DPSK-though-API-but-respond-400-error/m-p/44413#M3798</link>
      <description>&lt;P&gt;I think I fixed it after checking API in Postman. The body should be the format as below:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;$body_gen=[pscustomobject]@{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;amount = 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;userName = "abc"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;userRoleId = "e1538f2a-082c-4e19-b9d7-bc78de006967"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;groupDpsk = $false&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;If you don't need to input VlanID, you should totally remove it in the body.&lt;/P&gt;</description>
      <pubDate>Sat, 26 Mar 2022 08:40:34 GMT</pubDate>
      <guid>https://community.ruckuswireless.com/t5/SmartZone-and-Virtual-SmartZone/Powershell-Generate-DPSK-though-API-but-respond-400-error/m-p/44413#M3798</guid>
      <dc:creator>is_trouser</dc:creator>
      <dc:date>2022-03-26T08:40:34Z</dc:date>
    </item>
  </channel>
</rss>

