Skip to main content
Question

API, JSON Code for removing Synthetic Full Schedule


Forum|alt.badge.img+2

Hello everyone, 

We are creating a Server Backup Plan in CommandCenter that creates a plan and backup destination (storage pools for primary copy and secondary copy) and schedules. We select the schedule for full and incremental and plan creation completes successfully.

We can copy the API code of the above tasks and see the JSON file that creates then we programmatically create backup plans in batch via PowerShell. When we review the schedule in Java client. We see that it creates Synthetic Full schedule as well but this is not visible in commandcenter. We cannot use Synthetic Full in our environment due to storage limitation.

What do we need to add or remove to the JSON file command center creates for PLAN, and remove the Synthetic Full in the creation? I am attaching a sample JSON file.

We would to see a sample JSON file that creates the plan and removes Synthetic Full schedule.

 

JSON File:

 

$body = @"
{
  "planName": "$planName",
  "backupDestinations": [
    {
      "backupDestinationName": "Primary",
      "retentionPeriodDays": 28,
      "useExtendedRetentionRules": false,
      "storagePool": {
        "id": $SPIDP
      }
    },
    {
      "backupDestinationName": "Secondary_Copy",
      "retentionPeriodDays": 28,
      "useExtendedRetentionRules": false,
      "backupStartTime": -1,
      "backupsToCopy": "ALL_JOBS",
      "storagePool": {
        "id": $SPIDS
      }
    }
  ],
  "rpo": {
    "backupFrequency": {
      "schedules": [
        {
          "backupType": "INCREMENTAL",
          "scheduleOperation": "ADD",
          "schedulePattern": {
            "scheduleFrequencyType": "WEEKLY",
            "startTime": 57600,
            "frequency": 1,
            "weeklyDays": [
              "SUNDAY",
              "MONDAY",
              "TUESDAY",
              "THURSDAY",
              "FRIDAY",
              "SATURDAY"
            ]
          },
          "forDatabasesOnly": false
        },
        {
          "backupType": "FULL",
          "scheduleOperation": "ADD",
          "schedulePattern": {
            "scheduleFrequencyType": "WEEKLY",
            "startTime": 57600,
            "frequency": 1,
            "weeklyDays": [
            "$Fullday"
          ]
          },
          "forDatabasesOnly": false
        }
      ]
    },
    "backupWindow": [],
    "fullBackupWindow": []
  },
  "backupContent": {
    "windowsIncludedPaths": [
      "\\"
    ],
    "windowsExcludedPaths": [],
    "unixIncludedPaths": [
      "/"
    ],
    "unixExcludedPaths": [],
    "macIncludedPaths": [
      "/"
    ],
    "macExcludedPaths": [],
    "backupSystemState": true,
    "useVSSForSystemState": true,
    "backupSystemStateOnlyWithFullBackup": false
  },
  "snapshotOptions": {
    "enableBackupCopy": true,
    "backupCopyRPOMins": 240,
    "retentionPeriodDays": 30,
    "retentionRuleType": "RETENTION_PERIOD"
  },
  "allowPlanOverride": false,
  "databaseOptions": {
    "logBackupRPOMins": 240,
    "commitFrequencyInHours": 24,
    "useDiskCacheForLogBackups": false
  }
}
"@

 

Thank you! 

4 replies

Forum|alt.badge.img+15
  • Vaulter
  • 630 replies
  • February 14, 2023

Good afternoon.  Have you opened a case for this issue recently?  If so can you please provide the case number for review?


Forum|alt.badge.img+2

Hello,

Here is the case number: 230213-747

Thank you! 


Forum|alt.badge.img+15
  • Vaulter
  • 630 replies
  • February 15, 2023

Thank you for the update.  I will monitor this thread and that case.  Please update if you have any questions.


Forum|alt.badge.img+2

in case anyone needs it; Here is the Powershell Script that will delete all Synthetic Full from ALL schedules. 

 

 

 

# Let's get a token!
$credential = Get-Credential
$username = $credential.UserName
$password = $credential.GetNetworkCredential().password

# password needs to be in base64 format
$password = [System.Text.Encoding]::UTF8.GetBytes($password)
$password = [System.Convert]::ToBase64String($password)

#pre for headers
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Accept", "application/json")
$headers.Add("Content-Type", "application/json")
$body = "{`n  `"password`": `"$password`",`n  `"username`": `"$username`",`n  `"timeout`" : 30`n}"

# Login and get token
$response = Invoke-RestMethod 'http://my-commserve-server/webconsole/api/Login' -Method 'POST' -Headers $headers -Body $body
# need to get the token
$token = $response | Select-Object -ExpandProperty token
# the first five characters need to be removed to get just the token
$token = $token.substring(5)
# Now that we have a token we can do things
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Accept", "application/json")
$headers.Add("Authtoken", "$token")
$headers.Add("Content-Type", "application/json")

#Get Schedule Policy
$response = Invoke-RestMethod 'http://my-commserve-server/webconsole/api/SchedulePolicy' -Method 'GET' -Headers $headers
#Get Sub Tasks
$tasks = $response.taskDetail.task

#Count number of schedules so we know how many out there
$Count=1
$tasks.count

#Loop through each task and remove Synthetic fulls
foreach ($task in $tasks) {

	$taskId = $task.taskId
	$taskName = $task.taskName
	$response = Invoke-RestMethod "http://my-commserve-server/webconsole/api/SchedulePolicy/$taskId" -Method 'GET' -Headers $headers

	$staskID = $response.taskInfo.subTasks.subtask | where subTaskName -eq "Synthetic Fulls" | select -ExpandProperty SubTaskId
	if ($staskID -ne $NULL) {
		Write-Host "Synthetic Full Found - REMOVING) - $taskName (TaskID: $taskID) (SubtaskID: $staskID) (Counter: $count)" -ForegroundColor red
		#Removals
		$removal = Invoke-RestMethod "http://my-commserve-server/webconsole/api/SchedulePolicy/$taskID/Schedule/$staskID" -Method 'DELETE' -Headers $headers
		$removal
		Sleep 10
	} else {
		Write-Host "No Synthetic Fulls - $taskName (TaskID: $taskID) (Counter: $count)"
	}

	$count++

}

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings