1

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

here

thank you!

Gaurav Mantri
  • 128,066
  • 12
  • 206
  • 241

1 Answers1

1

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. 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.

"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.

Gaurav Mantri
  • 128,066
  • 12
  • 206
  • 241
  • whats the point of fetching offerterms if they are known beforehand? – 4c74356b41 Mar 26 '17 at 06:03
  • I am not sure I understand your question. You (as a person) may know the offer terms but Rate Card API provides a programmatic access to that information, I think. – Gaurav Mantri Mar 26 '17 at 06:04
  • Thank you Gaurav Mantri! – manolovalenzuela Mar 27 '17 at 13:39
  • I tried to be short on my explanation, according to the rules of stackoverflow I am a person, and a developer too, and I need to access the information programmatically I currently manage more than 30 subscriptions, and the costs are NOT known in advance as the user 4c74356b41 says So it is very desired, to be clear how much is the amount that is currently to be consumed and how many days remain for the period to be renewed. I want to program (using the API's) an application that should query for this data and present it in a "multi-subscription" dashboard. – manolovalenzuela Mar 27 '17 at 13:47
  • For now, your answer helps me!, I just want to know now, how many days remain from the actual moment, to the renew date. – manolovalenzuela Mar 27 '17 at 13:48
  • Since subscription billing period rarely changes, what you could do is create a custom database where you could store the billing period for each subscription. You can then query the database to get the days remaining in each subscription. HTH. – Gaurav Mantri Mar 27 '17 at 15:12
  • You are absolutely right Gaurav Mantri! thank you again. – manolovalenzuela Mar 28 '17 at 18:29
  • @GauravMantri How can we find total credit transactions made for subscription through RateCard API? I get below value in OfferTerms: "OfferTerms": [ { "ExcludedMeterIds": [], "Name": "Monetary Credit" } ], – Zahir Firasta Feb 02 '18 at 11:45