5

I was trying to query the usage and billing API that Azure recently recently and saw that I can use the following API to get the rate card:

https://management.azure.com/subscriptions/{subscription-id}/providers/Microsoft.Commerce/RateCard?api-version=2015-06-01-preview&$filter=OfferDurableId eq '{offer-id}' and Currency eq 'USD' and Locale eq 'en-US' and RegionInfo eq 'US'

However, this requires I need to explicity know the offerDurableId, which I came to know for my case from Azure's website.

Is there an API that will give me these offer codes?

jobin
  • 2,600
  • 7
  • 32
  • 59

3 Answers3

3

AFAIK, there is no API to get the offer codes. In fact if you look at Billing API documentation here, they also ask you to get the information about this from the link you mentioned.

Set {OfferDurableId} to a valid Offer ID code (e.g., MS-AZR-0026P). See Microsoft Azure Offer Details for more information on the list of available Offer IDs, country/region availability, and billing currency. The Offer ID parameter consists of the “MS-AZR-“ prefix, plus the Offer ID number.

Considering the offer code don't change, I think it is somewhat safe to save this information in your own database

Gaurav Mantri
  • 128,066
  • 12
  • 206
  • 241
  • I agree that offer codes won't change. But there can be more offers added, and some may retire too. How do I update that information? – jobin Aug 19 '15 at 11:39
  • I agree with you on adding new ones. However even if they retire old ones, I would imagine that they will still be valid for Billing API point of view. A user will not be able to sign up for a plan associated with retired codes though. Given that there's no API available today, I guess you are left with manually checking the website periodically. Other thing you could do is have a dropdown with existing values in your application and if your user doesn't see the appropriate code, they can come back and contact you (I know, it's kinda lame :)). – Gaurav Mantri Aug 19 '15 at 11:43
  • I'll just wait if someone is aware if there is an API for this, otherwise, yes, I have to agree with you :) – jobin Aug 19 '15 at 11:47
0

One possibility is this. But it's not documented or supported officially. It's the API which the Azure Portal calls to get the offer information.

https://stackoverflow.com/a/54324041/9893001

0

There is not public API for this, but there is a feature request, please vote for it.

Tomas Kubes
  • 23,880
  • 18
  • 111
  • 148