Application Integration
1752583 Members
5323 Online
108788 Solutions
New Discussion

[Rest API] - Enable Protection Group Sync

 
SOLVED
Go to solution
mpayne132
New Member

[Rest API] - Enable Protection Group Sync

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

1 REPLY 1
casey_crawford
New Member
Solution

Re: [Rest API] - Enable Protection Group Sync

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