当我取到Azure的定价单时
https://consumption.azure.com/v3/enrollments/{enrollmentNumber}/pricesheet 返回的JSON是所有Azure组件的价目表。列表有时返回offerId (MS-AZR-0017P或MS-AZR-0148P)的值,但大多数情况下,对于所有返回的记录,该值为NULL。
Problem:列表中两次提到每个meterId,而决定正确价格的是offerId。如果没有offerId,我无法确定具有相同meterId的两行中哪一行具有正确的unitPrice和partNumber。
尝试1 (成功):
"offerId": "MS-AZR-0017P",
"id": "enrollments/{enrollmentNumber}/billingperiods/201907/products/1001543/pricesheets",
"billingPeriodId": "201907",
"meterId": "b28a9f2d-9323-4021-8421-db9e3847a535",
"meterName": "Virtual Machines A Series Basic Windows - A2 - KR South",
"unitOfMeasure": "100 Hours",
"includedQuantity": 0.0000,
"partNumber": "AAA-38759",
"unitPrice": 12.3100,
"currencyCode": "EUR"
},
{
"offerId": "MS-AZR-0148P",
"id": "enrollments/{enrollmentNumber}/billingperiods/201907/products/1001544/pricesheets",
"billingPeriodId": "201907",
"meterId": "b28a9f2d-9323-4021-8421-db9e3847a535",
"meterName": "Virtual Machines A Series Basic Windows - A2 - Dev/Test - KR South",
"unitOfMeasure": "100 Hours",
"includedQuantity": 0.0000,
"partNumber": "AAA-38881",
"unitPrice": 8.1800,
"currencyCode": "EUR"
},尝试n (不成功):
"offerId": null,
"id": "enrollments/{enrollmentNumber}/billingperiods/201907/products/1001543/pricesheets",
"billingPeriodId": "201907",
"meterId": "b28a9f2d-9323-4021-8421-db9e3847a535",
"meterName": "Virtual Machines A Series Basic Windows - A2 - KR South",
"unitOfMeasure": "100 Hours",
"includedQuantity": 0.0000,
"partNumber": "AAA-38759",
"unitPrice": 12.3100,
"currencyCode": "EUR"
},
{
"offerId": null,
"id": "enrollments/{enrollmentNumber}/billingperiods/201907/products/1001544/pricesheets",
"billingPeriodId": "201907",
"meterId": "b28a9f2d-9323-4021-8421-db9e3847a535",
"meterName": "Virtual Machines A Series Basic Windows - A2 - Dev/Test - KR South",
"unitOfMeasure": "100 Hours",
"includedQuantity": 0.0000,
"partNumber": "AAA-38881",
"unitPrice": 8.1800,
"currencyCode": "EUR"
},我多次尝试使用Postman和Azure Data获取JSON,并使用REST调用,但似乎没有一种模式或可靠的方法来每次获得包括offerId在内的列表。因为我想在我的DWH中使用这些信息,所以我需要来自API的可靠和可预测的响应。
我期望API返回可靠和可预测的信息,每次查询API时都会在每个记录上包含正确的offerId。
To do:一旦获得许可,我将在Azure门户中创建一个支持票,以确定这是否是已知的bug或我做错了什么。
v3版本的文档并不是最新的。关于这一特定端点的文件上一次更新是在2017年4月:
https://learn.microsoft.com/en-us/rest/api/billing/enterprise/billing-enterprise-api-pricesheet
它还提到了较早的v2版本。
UsageDetails页面上的文档:
https://learn.microsoft.com/en-us/rest/api/billing/enterprise/billing-enterprise-api-usage-detail
更新了2019年3月,并提到了v3版本。
v2和v3响应对PriceSheet的最大区别是v3还返回offerId,这使得确定发票上提到的正确的unitPrice和partNumber成为可能。要能够将发票细节与实际使用情况交叉引用,您需要知道正确的partNumber,并为此需要offerId。
还有另一种解决方案,但在更改当前设置方面需要做大量工作。目前,我使用Azure导出函数来获取每24小时导出到CSV文件的使用细节。这些文件被导入DWH并进一步转换。但是CSV中的记录不包含partNumber。v3 usagedetails端点确实返回partNumber..。
摘要:我将创建一个Azure支持票并等待答案。同时,我将试图弄清楚为什么API返回不同的结果。
问题:谁在消费API上遇到过类似的问题,您是如何解决这些问题的?
问题:API返回不同结果的原因可能是什么?
发布于 2019-10-24 13:50:49
还有另一个价格单api
https://learn.microsoft.com/en-us/rest/api/consumption/pricesheet/get
它是在订阅级别而不是注册级别上查询的,因此要为您的注册获得完整的价目表,您必须使用不同的优惠id为每个订阅单独提出一个请求。
https://stackoverflow.com/questions/57108063
复制相似问题