Skip to content

Commit 77399b3

Browse files
sophiethekingCopilotguntrip
authored
Revise "Automating usage reporting with the REST API" (#59017)
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Co-authored-by: Felix Guntrip <guntrip@github.com>
1 parent eb5c1f8 commit 77399b3

File tree

3 files changed

+224
-90
lines changed

3 files changed

+224
-90
lines changed

content/billing/reference/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ children:
2323
- /product-usage-included
2424
- /roles-for-visual-studio
2525
- /supported-payment-methods
26+
- /previous-billing-platform-endpoints
2627
contentType: reference
2728
---
28-
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
---
2+
title: Migrating from the endpoints used for the previous billing platform
3+
shortTitle: Previous billing platform endpoints
4+
intro: 'If your organization previously used the billing platform that predated metered billing, this article explains how to migrate existing usage reporting to the current billing usage endpoints.'
5+
versions:
6+
fpt: '*'
7+
ghec: '*'
8+
topics:
9+
- Enterprise
10+
- Billing
11+
- REST
12+
permissions: 'Enterprise owners, organization owners, and billing managers'
13+
product: '{% data reusables.billing.enhanced-billing-platform-product %}'
14+
contentType: reference
15+
---
16+
17+
<!-- expires 2026-01-15 -->
18+
<!-- To check on whether this can be deleted or not, see the PM in ref: 6591 -->
19+
20+
After you transition to metered billing, the endpoints you used to get data from the previous billing platform will no longer return accurate usage information.
21+
22+
You will need to upgrade all calls using the previous `/ACCOUNT-TYPE/NAME/settings/billing/PRODUCT` REST API endpoints to use the equivalent `/ACCOUNT-TYPE/NAME/settings/billing/usage` endpoint.
23+
24+
## Changes in authentication
25+
26+
If you used a {% data variables.product.pat_v2 %} to authenticate with the previous endpoints, you will need create a {% data variables.product.pat_v1 %} to authenticate with the new endpoint.
27+
28+
In addition, you may want to use the new query parameters to specify a time period or cost center.
29+
30+
## Calculating {% data variables.product.prodname_actions %} information from the new response data
31+
32+
Example of the previous response
33+
34+
```json
35+
{"total_minutes_used": 305, "total_paid_minutes_used": 0, "included_minutes": 3000, "minutes_used_breakdown": { "UBUNTU": 205, "MACOS": 10, "WINDOWS": 90 } }
36+
```
37+
38+
Example of the new response
39+
40+
```json
41+
{ "usageItems": [ { "date": "2023-08-01", "product": "Actions", "sku": "Actions Linux", "quantity": 100, "unitType": "minutes", "pricePerUnit": 0.008, "grossAmount": 0.8, "discountAmount": 0, "netAmount": 0.8, "organizationName": "GitHub", "repositoryName": "github/example"} ] }
42+
```
43+
44+
To get the same values from the new response data:
45+
46+
{% rowheaders %}
47+
48+
| Previous property | Calculate from new API response |
49+
|------ |----------- |
50+
| `total_minutes_used` | <ol><li> Filter results by `"product": "Actions"` and `"unitType": "minutes"`</li><li>Sum `quantity`</li></ol>|
51+
| `total_paid_minutes_used`| This is now represented as a $ amount via `netAmount`.<ol><li>Filter results by `"product": "Actions"` and `"unitType": "minutes"`</li><li>Sum `netAmount`</li></ol>|
52+
| `included_minutes` | This is now represented as a $ amount via `discountAmount`.<ol><li>Filter results by `"product": "Actions"` and `"unitType": "minutes"`</li><li>Sum `discountAmount`</li></ol>|
53+
| `minutes_used_breakdown` | <ol><li>Filter results by `"product": "Actions"` and `"unitType": "minutes"`</li><li>Sum `quantity` grouped by `sku`</li></ol>|
54+
55+
{% endrowheaders %}
56+
57+
## Calculating {% data variables.product.prodname_registry %} information from the new response data
58+
59+
Example of the previous response
60+
61+
```json
62+
{ "total_gigabytes_bandwidth_used": 50, "total_paid_gigabytes_bandwidth_used": 40, "included_gigabytes_bandwidth": 10 }
63+
```
64+
65+
Example of the new response
66+
67+
```json
68+
{ "usageItems": [ { "date": "2023-08-01", "product": "Packages", "sku": "Packages data transfer", "quantity": 100, "unitType": "gigabytes", "pricePerUnit": 0.008, "grossAmount": 0.8, "discountAmount": 0, "netAmount": 0.8, "organizationName": "GitHub", "repositoryName": "github/example" } ] }
69+
```
70+
71+
{% rowheaders %}
72+
73+
| Previous property | Calculate from new API response |
74+
|------ |----------- |
75+
| `total_gigabytes_bandwidth_used` | <ol><li>Filter results by `"product": "Packages"` and `"unitType": "gigabytes"` </li><li>Sum `quantity`</li></ol> |
76+
| `total_paid_gigabytes_bandwidth_used`| This is now represented as a $ amount via `netAmount`. <ol><li>Filter results by `"product": "Packages"` and `"unitType": "gigabytes"`</li><li>Sum `netAmount`</li></ol> |
77+
| `included_gigabytes_bandwidth` | This is now represented as a $ amount via `discountAmount`.<ol><li>Filter results by `"product": "Packages"` and `"unitType": "gigabytes"`</li><li>Sum `discountAmount`</li></ol> |
78+
79+
{% endrowheaders %}
80+
81+
## Calculating shared storage information from the new response data
82+
83+
Example of the previous response
84+
85+
```json
86+
{ "days_left_in_billing_cycle": 20, "estimated_paid_storage_for_month": 15, "estimated_storage_for_month": 40 }
87+
```
88+
89+
Example of the new response
90+
91+
```json
92+
{ "usageItems": [ { "date": "2023-08-01", "product": "Packages", "sku": "Packages storage", "quantity": 100, "unitType": "GigabyteHours", "pricePerUnit": 0.008, "grossAmount": 0.8, "discountAmount": 0, "netAmount": 0.8, "organizationName": "GitHub", "repositoryName": "github/example" } ] }
93+
```
94+
95+
{% rowheaders %}
96+
97+
| Previous property | Calculate from new API response |
98+
|------ |----------- |
99+
| `days_left_in_billing_cycle` | Not available. This information can be inferred by subtracting the current day of the month from the number of days in the current month. |
100+
| `estimated_paid_storage_for_month`| This is now represented as a $ amount via `netAmount`. <br><br> Prerequisite: pass the `month` and `year` query parameters. <br><br> <i> For Actions storage </i> <ol><li> Filter results by `"product": "Actions"` and `"unitType": "GigabyteHours"`</li><li> Sum `netAmount`</li></ol> <i> For Packages storage </i> <ol><li> Filter results by `"product": "Packages"` and `"unitType": "GigabyteHours"`</li><li> Sum `netAmount`</li></ol>|
101+
| `estimated_storage_for_month` | Prerequisite: pass the `month` and `year` query parameters. <br><br> <i> For Actions storage </i> <ol><li> Filter results by `"product": "Actions"` and `"unitType": "GigabyteHours"`</li><li> Sum `quantity`</li></ol> <i> For Packages storage </i> <ol><li> Filter results by `"product": "Packages"` and `"unitType": "GigabyteHours"`</li><li> Sum `quantity`</li></ol>|
102+
103+
{% endrowheaders %}
104+
105+
<!-- end expires 2026-01-15 -->

0 commit comments

Comments
 (0)