Unable to fetch next 1000 records
IvoGuerreiro opened this issue · 1 comments
In Consumption I'm unable to fetch the next batch of records:
I'm able to get the first 1000 records with the following;
Azure::Consumption::Mgmt::V2019_05_01::ConsumptionManagementClient.usage_details.list_async(
"/subscriptions/#{@subscription_id}/", skiptoken: token
)
I get a successful response with a next link url:
`https://management.azure.com/subscriptions//providers/Microsoft.Consumption/usageDetails?api-version=2019-05-01&sessiontoken=21:32512334&$skiptoken=327C313030307C313030307C46616C73657C547275657C30&skiptokenver=v1&id=98fce233-f16f-49aa-8323-81d80e401f36"´
I extracted the skiptoken from the URL and pass it to the token variable in the next request:
Azure::Consumption::Mgmt::V2019_05_01::ConsumptionManagementClient.usage_details.list_async(
"/subscriptions/#{@subscription_id}/", skiptoken: token
)
But then I got the following error:
#<MsRest::HttpOperationError: {
"message": "MsRest::HttpOperationError",
"request": {
"base_uri": "https://management.azure.com",
"path_template": "{scope}/providers/Microsoft.Consumption/usageDetails",
"method": "get",
"path_params": null,
"skip_encoding_path_params": {
"scope": "/subscriptions/c75894a6-4794-4188-8106-c6dc1b92443e/"
},
"query_params": {
"$expand": null,
"$filter": null,
"$skiptoken": "327C313030307C313030307C46616C73657C547275657C30",
"$top": null,
"api-version": "2019-05-01",
"metric": null
},
"skip_encoding_query_params": null,
"headers": {
"Content-Type": "application/json; charset=utf-8",
"Accept": "application/json",
"accept-language": "en-US",
"x-ms-client-request-id": "ed9f83ca-ab4a-41e0-b8ee-e8d1fddc323a"
},
"body": null,
"middlewares": [
[
"MsRest::RetryPolicyMiddleware",
{
"times": 3,
"retry": 0.02
}
],
[
"cookie_jar"
]
],
"log": null
},
"response": {
"body": "{\"error\":{\"code\":\"400\",\"message\":\"id query parameter is not a valid Guid (Request ID: b8d8c502-a477-4375-83cf-4e3cce0e2b7f)\"}}",
"headers": {
"cache-control": "no-cache",
"pragma": "no-cache",
"content-length": "126",
"content-type": "application/json; odata.metadata=none",
"expires": "-1",
"session-id": "a65f9358-0161-459b-b637-4524d0b6bcc7",
"x-ms-request-id": "b8d8c502-a477-4375-83cf-4e3cce0e2b7f",
"x-ms-correlation-request-id": "72f12fca-382f-4566-a587-a56bbdbea29f",
"x-ms-client-request-id": "ed9f83ca-ab4a-41e0-b8ee-e8d1fddc323a",
"x-ms-ratelimit-microsoft.consumption-tenant-retry-after": "60",
"x-ms-ratelimit-remaining-microsoft.consumption-tenant-requests": "39",
"odata-version": "4.0",
"x-powered-by": "ASP.NET",
"x-ms-ratelimit-remaining-subscription-reads": "11998",
"x-ms-routing-request-id": "FRANCESOUTH:20201126T125819Z:72f12fca-382f-4566-a587-a56bbdbea29f",
"strict-transport-security": "max-age=31536000; includeSubDomains",
"x-content-type-options": "nosniff",
"date": "Thu, 26 Nov 2020 12:58:19 GMT"
},
"status": 400
}
}>
I'm assuming that's because I cant pass all other required variables to the next request namely the id params.
But I can't find any way to pass extra params to the request besides the skip token.
Anyone has any solution/workaround about this?
Thanks in advance
Best Regards
I got my own answer there is an list_next_async(url)
method to retrieve the next results