1 Reply Latest reply: Mar 20, 2016 2:10 AM by Casey Crawford RSS

    [Rest API] - Enable Protection Group Sync

    Matt Payne Newbie

      During some recent testing I was getting fed up of Veeam crashing into nimble synchronised snapshots. My solution to this would have been to add a pre & post script to the Veeam job to suspend synchronisation upon job start and re-enable at job end...

       

      According to the API documentation you call

      /v1/volume_collections/{id}

       

      e.g.

       

      $data = @{

                          app_sync = "vmware"

                          vcenter_hostname = "xxx"

                          vcenter_username = "xxx\xxx"

                          vcenter_password = "xxxv"                   

                      }

       

      $body = convertto-json (@{ data = $data })

      $result=Invoke-RestMethod -Uri $apiurl -Method PUT -Header $header -Body $body

       

      However I'm getting a 400 error...

       

      My request to suspend works fine - the only difference being:

      $data = @{

                          app_sync = "none"                 

                      }

       

      Can anyone confirm if this is allowed through the API?? We're running firmware 2.3.9.2-303808-opt on a CS300

        • Re: [Rest API] - Enable Protection Group Sync
          Casey Crawford Wayfarer

          Backslash is almost always used as an escape character, converto-json is escaping your single backslash:

           

          PS D:\powershellserver> $data = @{

          >>                     app_sync = "vmware"

          >>                     vcenter_hostname = "xxx"

          >>                     vcenter_username = "xxx\xxx"

          >>                     vcenter_password = "xxxv"

          >>                 }

          >>

          PS D:\powershellserver>

          PS D:\powershellserver> $body = convertto-json (@{ data = $data })

          PS D:\powershellserver> echo $body

          {

              "data":  {

                           "vcenter_password":  "xxxv",

                           "vcenter_hostname":  "xxx",

                           "vcenter_username":  "xxx\\xxx",

                           "app_sync":  "vmware"

                       }

          }

           

           

          I imagine this is why you are getting the 400 error (the API endpoint may not be interpreting the escaped backslash properly).

           

          I would suggest instead of DOMAIN\USER, you use USER@DOMAIN (better to use FQDN), vcenter doesn't care which version of the username you use.

           

          - Casey Crawford