Quantcast
Channel: Azure Backup forum
Viewing all articles
Browse latest Browse all 2741

Pagination in REST api for Azure Backup

$
0
0

I am trying to get a list of all the "Backup Protected Items" through the Azure Rest Api. In itself the query is working, results are returned. However, for some reason the list is limited at 200 items, while there are actually 213 items. If I add a filter to the query and split them up in "AzureIaasVM" and "AzureWorkLoad" (there is a combination of VM and SQL in Azure VM backups in this recovery vault), then I get the correct number of records returned.

But I don't understand why it stops at 200 items. There is no NextLink header that I can find pointing at a next resultset. Using "top" I can limit results but putting top at for instance 300 has no effect and still returns 200 items without a NextLink.

## token has already been requested at this point
$subscriptionId="xxx-xxxx-xxx-xxx"
$resourcegroupname="ResourceGroup"
$vaultname="MyVault"

$Headers=@{
    'authorization'="Bearer $token"
    'host'="management.azure.com"
    'contentype'='application/json'
}

$Uri = "https://management.azure.com/Subscriptions/" + $subscriptionId + "/resourceGroups/" + $resourceGroupName
$Uri += "/providers/Microsoft.RecoveryServices/vaults/" + $vaultName + "/backupProtectedItems?api-version=2017-07-01"

$test = Invoke-webrequest -Uri $Uri -Headers $Headers -Method Get

# Using Invoke-RestMethod makes no difference
# $Test always has 200 records (or less)



Viewing all articles
Browse latest Browse all 2741


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>