<?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: PI 3.2, Problem with device bulkimport with API in Controllers</title>
    <link>https://community.cisco.com/t5/controllers/pi-3-2-problem-with-device-bulkimport-with-api/m-p/3481478#M1800</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That error message indicates there's a problem in your script, specifically the print command which (I believe) intends to send things to an actual printer device.&amp;nbsp; If you're using PowerShell, you probably want to use Write-Host or something like that instead.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 30 Nov 2017 17:00:07 GMT</pubDate>
    <dc:creator>Spencer Zier</dc:creator>
    <dc:date>2017-11-30T17:00:07Z</dc:date>
    <item>
      <title>PI 3.2, Problem with device bulkimport with API</title>
      <link>https://community.cisco.com/t5/controllers/pi-3-2-problem-with-device-bulkimport-with-api/m-p/3481477#M1799</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to add devices with the API, with powershell script.&lt;/P&gt;&lt;P&gt;With credential profile or not, I alwayse have an error returned : Unable to initialize device PRN&lt;/P&gt;&lt;P&gt;Looks like there is something missing in ma parameters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Script is this one :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$CiscoPIServer='10.10.30.231'&lt;/P&gt;&lt;P&gt;$CiscoPIUser = 'CiscoPI'&lt;/P&gt;&lt;P&gt;$CiscoPIPwd =&amp;nbsp; 'Password'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;$url = "&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://$CiscoPIServer/webacs/api/v3/" rel="nofollow" target="_blank"&gt;https://$CiscoPIServer/webacs/api/v3/&lt;/A&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;add-type @"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; using System.Net;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; using System.Security.Cryptography.X509Certificates;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public class TrustAllCertsPolicy : ICertificatePolicy {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public bool CheckValidationResult(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ServicePoint srvPoint, X509Certificate certificate,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WebRequest request, int certificateProblem) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return true;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;"@&lt;/P&gt;&lt;P&gt;[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$Encoded = [System.Text.Encoding]::UTF8.GetBytes("$($CiscoPIUser):$($CiscoPIPwd)")&lt;/P&gt;&lt;P&gt;$EncodedPassword = [System.Convert]::ToBase64String($Encoded)&lt;/P&gt;&lt;P&gt;$headers = @{"Authorization"="Basic $($EncodedPassword)"}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Method type&lt;/P&gt;&lt;P&gt;$Method = "PUT"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$Resource = "op/devices/bulkImport.json"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$credentialProfileName = "ProfileName"&lt;/P&gt;&lt;P&gt;$ipAddress = "10.10.10.10"&lt;/P&gt;&lt;P&gt;$SNMPPort = "161"&lt;/P&gt;&lt;P&gt;$SNMPReadComm = "SNMPReadComm"&lt;/P&gt;&lt;P&gt;$SNMPWriteComm = "SNMPWriteComm"&lt;/P&gt;&lt;P&gt;$SNMPRetries = "2"&lt;/P&gt;&lt;P&gt;$SNMPTimeout = "30"&lt;/P&gt;&lt;P&gt;$SNMPVersion = "2c"&lt;/P&gt;&lt;P&gt;$protocol = "SSH2"&lt;/P&gt;&lt;P&gt;$cliTimeout = "40"&lt;/P&gt;&lt;P&gt;$cliUsername = "cliUsername"&lt;/P&gt;&lt;P&gt;$cliPassword = "cliPassword"&lt;/P&gt;&lt;P&gt;$cliEnablePassword = "cliEnablePassword"&lt;/P&gt;&lt;P&gt;$httpPort = "80"&lt;/P&gt;&lt;P&gt;$ufdname = "AutoImport"&lt;/P&gt;&lt;P&gt;$udfvalue = "ByOrchestrator"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$udf1 = [PsCustomObject] @{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "name" = $ufdname&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "value" = $udfvalue&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$Device1 = [PsCustomObject] @{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #"credentialProfileName" = $credentialProfileName&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "ipAddress" = $ipAddress&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "snmpPort" = $SNMPPort&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "snmpReadCommunity" = $SNMPReadComm&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "snmpWriteCommunity" = $SNMPWriteComm&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "snmpRetries" = $SNMPRetries&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "snmpTimeout" = $SNMPTimeout&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "snmpVersion" = $SNMPVersion&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "protocol" = $protocol&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "cliTimeout" = $cliTimeout&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "cliUsername" = $cliUsername&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "cliPassword" = $cliPassword&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "cliEnablePassword" = $cliEnablePassword&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "httpPort" = $httpPort&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "udfs" = [PsCustomObject] @{ "udf" = @($udf1) }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$Fullobject = [PsCustomObject] @{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "deviceImport" = [PsCustomObject] @{&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "devices" = [PsCustomObject] @{ "device" = @($Device1) }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;$body = $Fullobject | ConvertTo-Json -Depth 10&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $Result = Invoke-RestMethod -Method $Method -Uri $url/$Resource -Headers $headers&amp;nbsp; -Body $body -SessionVariable session -ContentType application/json &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;catch [Exception] {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print $_&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On the parameters given, I use Credential profile with IP address or IP address without profile and all other detailed field. Alwayse the same error returned&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Nov 2017 08:50:00 GMT</pubDate>
      <guid>https://community.cisco.com/t5/controllers/pi-3-2-problem-with-device-bulkimport-with-api/m-p/3481477#M1799</guid>
      <dc:creator>nicolassadeg</dc:creator>
      <dc:date>2017-11-30T08:50:00Z</dc:date>
    </item>
    <item>
      <title>Re: PI 3.2, Problem with device bulkimport with API</title>
      <link>https://community.cisco.com/t5/controllers/pi-3-2-problem-with-device-bulkimport-with-api/m-p/3481478#M1800</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That error message indicates there's a problem in your script, specifically the print command which (I believe) intends to send things to an actual printer device.&amp;nbsp; If you're using PowerShell, you probably want to use Write-Host or something like that instead.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Nov 2017 17:00:07 GMT</pubDate>
      <guid>https://community.cisco.com/t5/controllers/pi-3-2-problem-with-device-bulkimport-with-api/m-p/3481478#M1800</guid>
      <dc:creator>Spencer Zier</dc:creator>
      <dc:date>2017-11-30T17:00:07Z</dc:date>
    </item>
    <item>
      <title>Re: PI 3.2, Problem with device bulkimport with API</title>
      <link>https://community.cisco.com/t5/controllers/pi-3-2-problem-with-device-bulkimport-with-api/m-p/3481479#M1801</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No, sorry, the print is only here to print the error returned by the server, in this case, "Unable to initialize device PRN"&lt;/P&gt;&lt;P&gt;Without the print I have an (500) Internal Server Error Returned by PI.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any other idea ? Or something missing ? Or Bug on PI side ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Dec 2017 06:37:31 GMT</pubDate>
      <guid>https://community.cisco.com/t5/controllers/pi-3-2-problem-with-device-bulkimport-with-api/m-p/3481479#M1801</guid>
      <dc:creator>nicolassadeg</dc:creator>
      <dc:date>2017-12-01T06:37:31Z</dc:date>
    </item>
    <item>
      <title>Re: PI 3.2, Problem with device bulkimport with API</title>
      <link>https://community.cisco.com/t5/controllers/pi-3-2-problem-with-device-bulkimport-with-api/m-p/3705536#M1802</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I still have this problem, eaven in Pi 3.4... and even if I remove the try/catch command or use a writ-host...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The error is :&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000" face="Lucida Console" size="3"&gt;{"errorDocument":{"httpResponseCode":500,"httpMethod":"PUT","message":"com.fasterxml.jackson.core.JsonParseException: Unknown DTO type: deviceImport\n at [Source: org.apache.cxf.transport.http.AbstractHTTPDestination$1@595371a8; line: 12, column: 1]","exception":"javax.ws.rs.InternalServerErrorException: com.fasterxml.jackson.core.JsonParseException: Unknown DTO type: deviceImport\n at [Source: org.apache.cxf.transport.http.AbstractHTTPDestination$1@595371a8; line: 12, column: 1]","uriPath":"op/devices/bulkImport","queryParams":"{}","domain":"ROOT-DOMAIN"}}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And now, a new comment has been added in the API documentation, that was not here before... :&lt;/P&gt;
&lt;P style="color: rgb(85, 85, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: Verdana; font-size: 12px; font-style: normal; font-weight: 400; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;TL1 Credentials Support&lt;/P&gt;
&lt;UL style="color: rgb(85, 85, 85); text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: Verdana; font-size: 12px; font-style: normal; font-weight: 400; word-spacing: 0px; white-space: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255); font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;"&gt;
&lt;LI&gt;Transaction Language 1 (TL1) credentials are not currently supported for this operation.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;As I have this line in the script :&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#a9a9a9" face="Lucida Console" size="1"&gt;[&lt;/FONT&gt;&lt;FONT color="#008080" face="Lucida Console" size="1"&gt;Net.ServicePointManager&lt;/FONT&gt;&lt;FONT color="#a9a9a9" face="Lucida Console" size="1"&gt;]::&lt;/FONT&gt;&lt;FONT face="Lucida Console" size="1"&gt;SecurityProtocol &lt;/FONT&gt;&lt;FONT color="#a9a9a9" face="Lucida Console" size="1"&gt;=&lt;/FONT&gt; &lt;FONT color="#a9a9a9" face="Lucida Console" size="1"&gt;[&lt;/FONT&gt;&lt;FONT color="#008080" face="Lucida Console" size="1"&gt;Net.SecurityProtocolType&lt;/FONT&gt;&lt;FONT color="#a9a9a9" face="Lucida Console" size="1"&gt;]::&lt;/FONT&gt;&lt;FONT face="Lucida Console" size="1"&gt;Tls12&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can we do to have this operation working without TLS1 ?? (Also not working with SSL3...)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;Or any other help will be apreciated&lt;/P&gt;</description>
      <pubDate>Wed, 12 Sep 2018 13:04:19 GMT</pubDate>
      <guid>https://community.cisco.com/t5/controllers/pi-3-2-problem-with-device-bulkimport-with-api/m-p/3705536#M1802</guid>
      <dc:creator>nicolassadeg</dc:creator>
      <dc:date>2018-09-12T13:04:19Z</dc:date>
    </item>
  </channel>
</rss>

