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?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With