I am having difficulty building the URL correctly using URIBuilder in a grrovy script. This is what it the documentation says it should look like -
https://management.azure.com/subscriptions/{subscription-Id}/providers/Microsoft.Commerce/RateCard?api-version={api-version}&$filter=OfferDurableId eq ’{OfferDurableId}’ and Currency eq ’{Currency}’ and Locale eq ’{Locale}’ and RegionInfo eq ’{RegionInfo}’’
My code -
def urlRATECARD = 'https://management.azure.com/subscriptions/xxxx-xxxx-xxxx-xxxx/providers/Microsoft.Commerce/RateCard'
def uriRATECARD = new URIBuilder(urlRATECARD)
uriRATECARD.addQueryParam 'api-version','2015-06-01-preview'
uriRATECARD.addQueryParam '$filter', 'OfferDurableId eq`0003P`and Locale eq `en-AU` and Regioninfo eq `AU` and Currency eq `AUD`'
outputs -
which fails with the following error -
[Message:Invalid query specified. Please specify valid values for OfferDurableId, Currency, Locale and RegionInfo.]
Can anyone offer the correct way to create this?
If your subscription is Pay-As-You-Go
, OfferDurableId
is MS-AZR-0003p
.
You could check this example, before OFFER NUMBER
, it needs add MS-AZR-
.