首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >v3 API of consumption.azure.com大部分时间都无法返回offerId。

v3 API of consumption.azure.com大部分时间都无法返回offerId。
EN

Stack Overflow用户
提问于 2019-07-19 08:00:25
回答 1查看 302关注 0票数 0

当我取到Azure的定价单时

代码语言:javascript
复制
https://consumption.azure.com/v3/enrollments/{enrollmentNumber}/pricesheet 

返回的JSON是所有Azure组件的价目表。列表有时返回offerId (MS-AZR-0017PMS-AZR-0148P)的值,但大多数情况下,对于所有返回的记录,该值为NULL。

Problem:列表中两次提到每个meterId,而决定正确价格的是offerId。如果没有offerId,我无法确定具有相同meterId的两行中哪一行具有正确的unitPrice和partNumber。

尝试1 (成功):

代码语言:javascript
复制
    "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 (不成功):

代码语言:javascript
复制
    "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,这使得确定发票上提到的正确的unitPricepartNumber成为可能。要能够将发票细节与实际使用情况交叉引用,您需要知道正确的partNumber,并为此需要offerId

还有另一种解决方案,但在更改当前设置方面需要做大量工作。目前,我使用Azure导出函数来获取每24小时导出到CSV文件的使用细节。这些文件被导入DWH并进一步转换。但是CSV中的记录不包含partNumber。v3 usagedetails端点确实返回partNumber..。

摘要:我将创建一个Azure支持票并等待答案。同时,我将试图弄清楚为什么API返回不同的结果。

问题:谁在消费API上遇到过类似的问题,您是如何解决这些问题的?

问题:API返回不同结果的原因可能是什么?

EN

回答 1

Stack Overflow用户

发布于 2019-10-24 13:50:49

还有另一个价格单api

https://learn.microsoft.com/en-us/rest/api/consumption/pricesheet/get

它是在订阅级别而不是注册级别上查询的,因此要为您的注册获得完整的价目表,您必须使用不同的优惠id为每个订阅单独提出一个请求。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57108063

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档