Skip to content

Commit cb013c1

Browse files
Merge pull request #264106 from bandersmsft/api-date-support
MCM - Misc updates for API date support
2 parents 28c76a3 + fb09a38 commit cb013c1

File tree

2 files changed

+46
-46
lines changed

2 files changed

+46
-46
lines changed

articles/cost-management-billing/automate/get-small-usage-datasets-on-demand.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ titleSuffix: Microsoft Cost Management
44
description: The article explains how you can use the Cost Details API to get raw, unaggregated cost data that corresponds to your Azure bill.
55
author: bandersmsft
66
ms.author: banders
7-
ms.date: 11/17/2023
7+
ms.date: 01/24/2024
88
ms.topic: conceptual
99
ms.service: cost-management-billing
1010
ms.subservice: cost-management
@@ -13,13 +13,13 @@ ms.reviewer: jojoh
1313

1414
# Get small cost datasets on demand
1515

16-
Use the [Cost Details](/rest/api/cost-management/generate-cost-details-report) API to get raw, unaggregated cost data that corresponds to your Azure bill. The API is useful when your organization needs a programmatic data retrieval solution. Consider using the API if want to analyze smaller cost data sets of 2 GB (2 million rows) or less. However, you should use Exports for ongoing data ingestion workloads and for the download of larger datasets.
16+
Use the [Cost Details](/rest/api/cost-management/generate-cost-details-report) API to get raw, unaggregated cost data that corresponds to your Azure bill. The API is useful when your organization needs a programmatic data retrieval solution. Consider using the API if you want to analyze smaller cost data sets of 2 GB (2 million rows) or less. However, you should use Exports for ongoing data ingestion workloads and for the download of larger datasets.
1717

1818
If you want to get large amounts of exported data regularly, see [Retrieve large cost datasets recurringly with exports](../costs/ingest-azure-usage-at-scale.md).
1919

2020
To learn more about the data in cost details (formerly referred to as *usage details*), see [Ingest cost details data](automation-ingest-usage-details-overview.md).
2121

22-
The [Cost Details](/rest/api/cost-management/generate-cost-details-report) report is only available for customers with an Enterprise Agreement or Microsoft Customer Agreement. If you're an MSDN, Pay-As-You-Go or Visual Studio customer, see [Get cost details for a pay-as-you-go subscription](get-usage-details-legacy-customer.md).
22+
The [Cost Details](/rest/api/cost-management/generate-cost-details-report) report is only available for customers with an Enterprise Agreement or Microsoft Customer Agreement. If you're an MSDN, pay-as-you-go or Visual Studio customer, see [Get cost details for a pay-as-you-go subscription](get-usage-details-legacy-customer.md).
2323

2424
## Permissions
2525

@@ -40,7 +40,7 @@ Microsoft recommends the following best practices as you use the Cost Details AP
4040

4141
### Request schedule
4242

43-
If you want to get the latest cost data, we recommend you query at most once per day. Reports are refreshed every four hours. If you call more frequently, you'll receive identical data. Once you download your cost data for historical invoices, the charges won't change unless you're explicitly notified. We recommend caching your cost data in a queryable store on your side to prevent repeated calls for identical data.
43+
If you want to get the latest cost data, we recommend you query at most once per day. Reports are refreshed every four hours. If you call more frequently, you receive identical data. Once you download your cost data for historical invoices, the charges don't change unless you're explicitly notified. We recommend caching your cost data in a queryable store on your side to prevent repeated calls for identical data.
4444

4545
### Chunk your requests
4646

@@ -56,13 +56,13 @@ On demand calls to the API are rate limited. The time it takes to generate your
5656

5757
### Supported dataset time ranges
5858

59-
The Cost Details API supports a maximum data set time range of one month per report. Historical data can be retrieved for up to 13 months back from the current date. If you're looking to seed a 13 month historical dataset, we recommend placing 13 calls for one month datasets going back 13 months.
59+
The Cost Details API supports a maximum data set time range of one month per report. Historical data can be retrieved for up to 13 months before the current date. If you want to seed a 13-month historical dataset, we recommend placing 13 calls in one month datasets for the past 13 months. To retrieve historical data that is older than 13 months, use the [Exports REST API](/rest/api/cost-management/exports).
6060

6161
## Example Cost Details API requests
6262

63-
The following example requests are used by Microsoft customers to address common scenarios. The data that's returned by the request corresponds to the date when the cost was received by the billing system. It might include costs from multiple invoices. It's an asynchronous API. As such, you place an initial call to request your report and receive a polling link in the response header. From there, you can poll the link provided until the report is available for you.
63+
The following example requests are used by Microsoft customers to address common scenarios. The data returned by the request corresponds to the date when the cost got received by the billing system. It might include costs from multiple invoices. It's an asynchronous API. As such, you place an initial call to request your report and receive a polling link in the response header. From there, you can poll the link provided until the report is available for you.
6464

65-
Use the `retry-after` header in the API response to dictate when to poll the API next. The header provides an estimated minimum time that your report will take to generate.
65+
Use the `retry-after` header in the API response to dictate when to poll the API next. The header provides an estimated minimum time that your report takes to generate.
6666

6767
To learn more about the API contract, see [Cost Details](/rest/api/cost-management/generate-cost-details-report) API.
6868

@@ -72,7 +72,7 @@ To control whether you would like to see an actual cost or amortized cost report
7272

7373
Amortized cost breaks down your reservation purchases into daily chunks and spreads them over the duration of the reservation term. For example, instead of seeing a $365 purchase on January 1, you'll see a $1.00 purchase every day from January 1 to December 31. In addition to basic amortization, the costs are also reallocated and associated by using the specific resources that used the reservation. For example, if the $1.00 daily charge was split between two virtual machines, you'd see two $0.50 charges for the day. If part of the reservation isn't utilized for the day, you'd see one $0.50 charge associated with the applicable virtual machine and another $0.50 charge with a charge type of `UnusedReservation`. Unused reservation costs are seen only when viewing amortized cost.
7474

75-
Because of the change in how costs are represented, it's important to note that actual cost and amortized cost views will show different total numbers. In general, the total cost of months over time for a reservation purchase will decrease when viewing amortized costs. The months following a reservation purchase will increase. Amortization is available only for reservation purchases and doesn't currently apply to Azure Marketplace purchases.
75+
Because of the change in how costs are represented, it's important to note that actual cost and amortized cost views show different total numbers. In general, the total cost of months over time for a reservation purchase will decrease when viewing amortized costs. The cost of months following a reservation purchase increase. Amortization is available only for reservation purchases and doesn't currently apply to Azure Marketplace purchases.
7676

7777
### Initial request to create report
7878

@@ -82,7 +82,7 @@ POST https://management.azure.com/{scope}/providers/Microsoft.CostManagement/gen
8282

8383
**Request body:**
8484

85-
An example request for an ActualCost dataset for a specified date range is provided below.
85+
Here's an example request for an ActualCost dataset for a specified date range.
8686

8787
```json
8888
{
@@ -97,16 +97,16 @@ An example request for an ActualCost dataset for a specified date range is provi
9797

9898
Available *{scope}* options to build the proper URI are documented at [Identify the resource ID for a scope](../costs/understand-work-scopes.md#identify-the-resource-id-for-a-scope).
9999

100-
The available fields you can provide in the report request body are summarized below.
100+
Here are the available fields you can provide in the report request body.
101101

102-
- **metric** - The type of report requested. It can be either ActualCost or AmortizedCost. Not required. If the field isn't specified, the API will default to an ActualCost report.
103-
- **timePeriod** - The requested date range for your data. Not required. This parameter can't be used alongside either the invoiceId or billingPeriod parameters. If a timePeriod, invoiceId or billingPeriod parameter isn't provided in the request body the API will return the current month's cost.
104-
- **invoiceId** - The requested invoice for your data. This parameter can only be used by Microsoft Customer Agreement customers. Additionally, it can only be used at the Billing Profile or Customer scope. This parameter can't be used alongside either the billingPeriod or timePeriod parameters. If a timePeriod, invoiceId or billingPeriod parameter isn't provided in the request body the API will return the current month's cost.
105-
- **billingPeriod** - The requested billing period for your data. This parameter can be used only by Enterprise Agreement customers. Use the YearMonth format. For example, 202008. This parameter can't be used alongside either the invoiceId or timePeriod parameters. If a timePeriod, invoiceId or billingPeriod parameter isn't provided in the request body the API will return the current month's cost.
102+
- **metric** - The type of report requested. It can be either ActualCost or AmortizedCost. Not required. If the field isn't specified, the API defaults to an ActualCost report.
103+
- **timePeriod** - The requested date range for your data. Not required. This parameter can't be used alongside either the invoiceId or billingPeriod parameters. If a timePeriod, invoiceId or billingPeriod parameter isn't provided in the request body the API returns the current month's cost.
104+
- **invoiceId** - The requested invoice for your data. This parameter is only used by Microsoft Customer Agreement customers. Additionally, it can only be used at the Billing Profile or Customer scope. This parameter can't be used alongside either the billingPeriod or timePeriod parameters. If a timePeriod, invoiceId or billingPeriod parameter isn't provided in the request body the API returns the current month's cost.
105+
- **billingPeriod** - The requested billing period for your data. This parameter is only used by Enterprise Agreement customers. Use the YearMonth format. For example, 202008. This parameter can't be used alongside either the invoiceId or timePeriod parameters. If a timePeriod, invoiceId or billingPeriod parameter isn't provided in the request body the API returns the current month's cost.
106106

107107
**API response:**
108108

109-
`Response Status: 202 – Accepted` : Indicates that the request will be processed. Use the `Location` header to check the status.
109+
`Response Status: 202 – Accepted` : Indicates that the request was accepted. Use the `Location` header to check the status.
110110

111111
Response headers:
112112

@@ -117,15 +117,15 @@ Response headers:
117117

118118
### Report polling and download
119119

120-
Once you've requested to create a Cost Details report, poll for the report using the endpoint provided in the `location` header of the API response. An example polling request is below.
120+
Poll for the report using the endpoint provided in the `location` header of the API response after you make a request to create a Cost Details report. Here's an example polling request.
121121

122122
Report polling request:
123123

124124
```http
125125
GET https://management.azure.com/{scope}/providers/Microsoft.CostManagement/costDetailsOperationStatus/{operationId}?api-version=2022-05-01
126126
```
127127

128-
`Response Status 200 – Succeeded`: Indicates that the request has succeeded.
128+
`Response Status 200 – Succeeded`: Indicates that the request succeeded.
129129

130130
```JSON
131131
{
@@ -159,18 +159,18 @@ GET https://management.azure.com/{scope}/providers/Microsoft.CostManagement/cost
159159
}
160160
```
161161

162-
A summary of the key fields in the API response is below:
162+
Here's a summary of the key fields in the API response:
163163

164-
- **manifestVersion** - The version of the manifest contract that is used in the response. At this time, the manifest version will remain the same for a given API version.
164+
- **manifestVersion** - The version of the manifest contract that is used in the response. At this time, the manifest version remains the same for a given API version.
165165
- **dataFormat** - CSV is the only supported file format provided by the API at this time.
166-
- **blobCount** - Represents the number of individual data blobs present in the report dataset. It's important to note that this API may provide a partitioned dataset of more than one file in the response. Design your data pipelines to be able to handle partitioned files accordingly. Partitioning will allow you to be able to ingest larger datasets more quickly moving forward.
166+
- **blobCount** - Represents the number of individual data blobs present in the report dataset. It's important to note that this API might provide a partitioned dataset of more than one file in the response. Design your data pipelines to be able to handle partitioned files accordingly. Partitioning allows you to be able to ingest larger datasets more quickly moving forward.
167167
- **byteCount** - The total byte count of the report dataset across all partitions.
168168
- **compressData** - Compression is always set to false for the first release. The API will support compression in the future, however.
169169
- **requestContext** - The initial configuration requested for the report.
170170
- **blobs** - A list of n blob files that together comprise the full report.
171171
- **blobLink** - The download URL of an individual blob partition.
172172
- **byteCount** - The byte count of the individual blob partition.
173-
- **validTill** - The date at which the report will no longer be accessible.
173+
- **validTill** - The date when the report is no longer accessible.
174174

175175
## Next steps
176176

0 commit comments

Comments
 (0)