- This topic has 0 replies, 1 voice, and was last updated April 11, 2019 by Rob H.
Issue Using Rest API to Return VPG Settings
-
Hi,
I’m having difficulties trying to retrieve VPG Settings using the API for Zerto 5.0 U3 build 050301165
I have a script which is very similar to the one which starts on page 20 of http://s3.amazonaws.com/zertodownload_docs/4.0U6/White%20Paper%20-%20Automating%20Zerto%20Virtual%20Replication%20with%20PowerShell%20and%20REST%20APIs%20v2.0.pdf
It works fine for the majority of VPGs, however, when I try to run “$VPGSettingsIdentifier = Invoke-RestMethod -Method Post -Uri $CreateVPGURL -Body $JSON -ContentType $TypeJSON -Headers $zertoSessionHeader” against a VPG where a setting identifier has been removed from the vCenter inventory, the following error is returned:
Invoke-RestMethod : {“Message”:”Setting validation failed: Default journal datastore [Datastore [DatastoreIdentifier], server [ServerIdentifier] doesn’t exist in site [SiteIdentifier]!; “}
I have also tried to use the GET method, both with JSON and XML:
Invoke-RestMethod -Method Get -Uri ($baseURL + “vpgSettings”) -ContentType $TypeJSON -Headers $zertoSessionHeader_JSON
The above returns an empty array.
Invoke-RestMethod -Method Get -Uri ($baseURL + “vpgSettings”) -ContentType $TypeXML -Headers $zertoSessionHeader_XML
The above does return an XML object but it doesn’t contain any VPG settings. Appending ” | Select -ExpandProperty ArrayOfVpgSettingsApi | fl *” to the above returns:
xmlns : http://schemas.zerto.com/zvm/api
i : http://www.w3.org/2001/XMLSchema-instance
Name : ArrayOfVpgSettingsApi
LocalName : ArrayOfVpgSettingsApi
NamespaceURI : http://schemas.zerto.com/zvm/api
Prefix :
NodeType : Element
ParentNode : #document
OwnerDocument : #document
IsEmpty : True
Attributes : {xmlns, xmlns:i}
HasAttributes : True
SchemaInfo : System.Xml.XmlName
InnerXml :
InnerText :
NextSibling :
PreviousSibling :
Value :
ChildNodes : {}
FirstChild :
LastChild :
HasChildNodes : False
IsReadOnly : False
OuterXml : <ArrayOfVpgSettingsApi xmlns=”http://schemas.zerto.com/zvm/api” xmlns:i=”http://www.w3.org/2001/XMLSchema-instance” />
BaseURI :
PreviousText :I would expect there to be a member called something like “VpgSettingsApi” with each VPG’s settings listed therein.
So I have 2 questions:
- Is there a way I can make the POST method return the settings, even when a VPG references VI objects which no longer exist
- Is the GET method request using the correct format as the following document appears to suggest that should return all VPG settings (p120) – http://s3.amazonaws.com/zertodownload_docs/5.0U4/Zerto%20Virtual%20Replication%20RESTful%20APIs.pdf
PS – Obviously I will need to correct the VPG configuration, however, I want the script to capture all VPGs regardless of whether there is any incorrect config. Also, this would presumably cause problems if trying to update the VPG configuration via the API?
Thanks in advance.