如何使用Azure Billing API获得“可用信用"和“剩余天数"? [英] How to get 'credit available' and 'days remain' using Azure Billing API?

查看:98
本文介绍了如何使用Azure Billing API获得“可用信用"和“剩余天数"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用如下所示的Azure Billing或RateCard API获取旧管理门户的两个指标?

Is it possible to get the two indicators of the old management portal using the Azure Billing or RateCard API like shown below?

谢谢!

推荐答案

因此,您需要寻找两件事:

So there're two things you're looking for:

  • 订阅的结算期:从今天开始,无法以编程方式获取订阅的结算期.
  • 剩余信用额度:剩余信用额度无法通过API直接获得,但是可以计算得出.首先,您需要找到可用的总积分.可以通过 Rate Cart API 来获取此信息.这将在响应中的OfferTerms元素下提供.
  • 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. For this first, you would need to find the total credits available. This information can be fetched via Rate Cart API. This will be available under OfferTerms element in the response.

优惠条款":[ { 名称":货币信贷", 信用":500.0 , "ExcludedMeterIds":[ "c7c86eef-7094-47d5-83e7-c3c9be5af0bf", "4b8b8092-a2d7-4785-9b9f-76104f4c7269", "7e266189-fb95-4615-af5b-126a00e78714", "20f1b323-0950-4527-b4f3-d77e2b7aca16" ], 有效日期":"2014-04-01T00:00:00Z" }]

"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" } ]

接下来,您需要使用 .根据用量和价目表,您需要计算用量.信用额与该金额之间的差额将为您提供剩余金额.

Next you would need to calculate the actual usage using the 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.

这篇关于如何使用Azure Billing API获得“可用信用"和“剩余天数"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆