简体   繁体   English

如何使用Azure Billing API获得“可用信用”和“剩余天数”?

[英]How to get 'credit available' and 'days remain' using Azure Billing API?

Is it possible to get the two indicators of the old management portal using the Azure Billing or RateCard API like shown below? 是否可以使用如下所示的Azure Billing或RateCard API获取旧管理门户的两个指标?

这里

thank you! 谢谢!

So there're two things you're looking for: 因此,您需要寻找两件事:

  • Subscription Billing Period : As of today, it is not possible to fetch the billing period of a Subscription programmatically. 订阅计费期 :从今天开始,无法以编程方式获取订阅的计费期。
  • Remaining Credits : Remaining credits is not directly available via the API however it is possible to calculate this. 剩余积分 :剩余积分无法通过API直接获得,但是可以计算得出。 For this first, you would need to find the total credits available. 首先,您需要找到可用的总积分。 This information can be fetched via Rate Cart API . 可以通过Rate Cart API获取此信息。 This will be available under OfferTerms element in the response. 这将在响应中的OfferTerms元素下提供。

"OfferTerms": [ { "Name": "Monetary Credit", "Credit": 500.0 , "ExcludedMeterIds": [ "c7c86eef-7094-47d5-83e7-c3c9be5af0bf", "4b8b8092-a2d7-4785-9b9f-76104f4c7269", "7e266189-fb95-4615-af5b-126a00e78714", "20f1b323-0950-4527-b4f3-d77e2b7aca16" ], "EffectiveDate": "2014-04-01T00:00:00Z" } ] “ OfferTerms”:[{“ Name”:“货币信贷”, “ Credit”:500.0 ,“ ExcludedMeterIds”:[“ c7c86eef-7094-47d5-83e7-c3c9be5af0bf”,“ 4b8b8092-a2d7-4785-9b9f-76104f4c7269”, “ 7e266189-fb95-4615-af5b-126a00e78714”,“ 20f1b323-0950-4527-b4f3-d77e2b7aca16”],“ EffectiveDate”:“ 2014-04-01T00:00:00Z”}]

Next you would need to calculate the actual usage using the Usage API . 接下来,您需要使用Usage API计算实际使用量。 Based on the usage and the rate card, you will need to calculate the usage amount. 根据用量和价目表,您需要计算用量。 Difference between the credit and this amount will give you remaining amount. 信用额与该金额之间的差额将为您提供剩余金额。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM