• This topic has 1 reply, 2 voices, and was last updated September 5, 2021 by Robert M.

Is this the correct process to change VPG via API

  • The following code completes without error, but it doesn’t do anything either. Is this even the correct process to change the journal history in an existing VPG?

    write-host “#1. Get Identifier to use in VPG settings object”
    $JSONIdentifier=”{““VpgIdentifier””:””103f201a-35f3-4d3e-a5e5-a6010efabfbf””}”
    $VPGSettingsIdentifierUrl = $BaseURL+”vpgsettings”
    $VPGSettingsIdentifier = Invoke-RestMethod -Method POST -Uri $VPGSettingsIdentifierUrl -Body $JSONIdentifier -Headers $ZertoSessionHeader -ContentType $Type

    write-host “#2. Get VPG Settings”
    $VPGSettingsUrl = $BaseURL+”vpgsettings/”+$VPGSettingsIdentifier
    $VPGSettings = Invoke-RestMethod -Method GET -Uri $VPGSettingsUrl -Headers $ZertoSessionHeader -ContentType $Type

    write-host “#3. Change Journal History Setting”
    $JSONBasicSettings=“{“”JournalHistoryInHours””:24}”

    $VPGBasicSettingsUrl = $BaseURL+”vpgsettings/”+$VPGSettingsIdentifier+”/basic”
    $VPGBasicSettings = Invoke-RestMethod -Method PUT -Uri $VPGBasicSettingsUrl -Body $JSONBasicSettings -Headers $ZertoSessionHeader -ContentType $Type

    write-host “#4. Commit new VPG Settings”
    $VPGSettingsCommitUrl = $BaseURL+”vpgsettings/”+$VPGSettingsIdentifier+”/commit”
    $VPGSettingsCommit = Invoke-RestMethod -Method POST -Uri $VPGSettingsCommitUrl -Headers $ZertoSessionHeader -ContentType $Type

    Assuming that you are getting no other errors when you run your script and you are successfully connecting to your ZVM, this script should work as you have it. I was able to copy and paste this script and only had to change two things.

    1). use my own VGPIdentifier

    2) make sure I was defining $type = “application/JSON”

    After I did those two things, I was able to change my journal history back and forth several times and saw the change in the GUI every time I did so.

You must be logged in to create new topics. Click here to login