3 Replies Latest reply on Sep 20, 2019 6:31 AM by gjvmc

    PowerCLI/VMC API Exception

    gjvmc Lurker

      Hi All,

      We're using PowerCLI 11.4 to pull back information about our VMC SDDCs. Sometime this weekend the method we're using stopped working.

      This is a minimal way to reproduce the issue:

      connect-vmc -apitoken <token>
      $org=get-vmcorg
      $sddcsvc=Get-VmcService -Name com.vmware.vmc.orgs.sddcs
      $sddcsvc.list($org.id)

      This method returns an exception with error message 'Unable to cast object of type 'vmware.vapi.data.OptionalValue' to type 'vmware.vapi.data.StringValue'.' with the attached stack trace.

      I'm wondering if anyone else is seeing this. It seems to be happening at the nexus between PowerCLI and the VMC API so I'm not sure which team would be able to address it. 

      Thanks

        • 1. Re: PowerCLI/VMC API Exception
          Zsoldier Expert
          vExpert

          To narrow down where you need to reach out for support, I would make raw REST calls using invoke-restmethod.

           

          If you get something workable, then it's powercli.  If you get the same garbage, then it might be powershell (Core or Legacy) in general.  Lastly, you can check with something like postman to determine if it's the VMC API endpoint giving you grief.

          • 2. Re: PowerCLI/VMC API Exception
            gjvmc Lurker

            I should add that I was able to use the REST API directly via the VMC "Developer Center" to hit the "/orgs/{org}/sddcs" endpoint and pull back the list of SDDCs. I assume that's the same endpoint that is used by PowerCLI.

            I have replicated it from several machines here so I suspect something changed in the VMC API that's causing PowerCLI to throw the exception but I'd be curious if anyone outside my org is having the same issue. 

            • 3. Re: PowerCLI/VMC API Exception
              gjvmc Lurker

              Hi All,

               

              Just in case anyone else is experiencing this issue it appears there was a change to the VMC API that impacted the data PowerCLI was expecting to get back. VMware has said they will be applying a fix in the next day or so.