Pagination Metadata

Some of the API calls support pagination (page number and page size). To get the metadata related to pagination, the REST call must send the following value in the Header section:

X-Api-Version should be 2 or greater


This functionality is only available using this specific header, and the result has three sections: 

  1. Data: The paged data of the whole result set. There will be a number of items (as stated by the page size) per page. This data is the same as the result from the call to the API without the header X-Api-Version set to 2 or greater.
  2. Paging: Contains the paging metadata: current page number, page size, result set offset, total number of records and total number of pages.
  3. Links: Contains the URLs related to the pagination, in order to get ready links to next, previous, first and last pages, as well as for the current page (self).

The JSON structure that is returned will be in the following form, for any given API call which supports paging:

The example is the result set for the call:

http://<host_name>/api/Subscriptions/{subscription_id}/azureusagerecords

Request

GET /api/Subscriptions/{subscription_id}/azureusagerecords?startDate=2016-01-01&endDate=2016-12-30&page=2&size=25 HTTP/1.1
Host: <host_name>
Authorization: Bearer HzsCIy2cdgUe14drbSrqIkcyChVoGXIjrAyeWyW8v9oSWaA-ph7Jl1tZ-_-FwJQnzYtUP0LuRwKt-oOb0GYGiuAGEuOZv33PRES7rNJq2VftZT1HF_B-U_CpONC0RLiIKWV_zwA0K83yArBdBhr7ys8d2nqYMb9m002ydZp9wdMYJCtl8uUO6mahS_CZlS6YwfXvs-N_ZS5Y6H8w4mQj72uNB6xxJDAfItCw5mYWXFlid6nBaIotzDy8HwbyCptXp4WEDyogTaT1Td5YfFrwjuqtigw5Xc2afl6IDbraxt1CnUyP1lVDjc68fdVVQRASClriAFRzj1sUGlRFZ6N2Mtywv1Fwqb4au-iEFDSF0zXAuPzIrF8vWo-o3RTXz4zQ16Wubr8olG_jM8cIOTlYbuapmQimZXn3IHrl9u2VLhrNMt5IEVm12VfMQm7D1tZKtD41gcIOXJMVmOsBa31QwZTYPRbX67tz77cQZ7Y5adHy6Y2bTKHDFcmDFGr_pPG8TyXpPYHJLWK7ZQlxkGd7iA
X-Api-Version: 2


JSON Response for paged result set using X-Api-Version

{
   "data":[
      {
         "meterName":"x4lvxo7gqraicvmscalenasa - Standard IO - Table/ Queue (GB)",
         "meterCategory":"Storage",
         "meterSubCategory":"Locally Redundant",
         "meterRegion":"",
         "unit":"GB",
         "resourceGroup":"RGSOFIAVMTEST",
         "totalQuantity":0.0004720000,
         "resourceName":"x4lvxo7gqraicvmscalenasa"
      }
   ],
   "paging":{
      "page":2,
      "size":25,
      "offset":25,
      "totalCount":26,
      "pageCount":2
   },
   "links":{
      "self":{
         "uri":"http://<host_name>/api/Subscriptions/{subscription_id}/azureusagerecords?startDate=2016-01-01&endDate=2016-12-30&page=2&size=25",
         "method":"GET",
         "headers":{
            "x-Api-Version":"2"
         }
      },
      "first":{
         "uri":"http://<host_name>/api/Subscriptions/{subscription_id}/azureusagerecords?startDate=2016-01-01&endDate=2016-12-30&page=1&size=25",
         "method":"GET",
         "headers":{
            "x-Api-Version":"2"
         }
      },
      "last":{
         "uri":"http://<host_name>/api/Subscriptions/{subscription_id}/azureusagerecords?startDate=2016-01-01&endDate=2016-12-30&page=2&size=25",
         "method":"GET",
         "headers":{
            "x-Api-Version":"2"
         }
      },
      "next":null,
      "previous":{
         "uri":"http://<host_name>/api/Subscriptions/{subscription_id}/azureusagerecords?startDate=2016-01-01&endDate=2016-12-30&page=1&size=25",
         "method":"GET",
         "headers":{
            "x-Api-Version":"2"
         }
      }
   }
}